Cleaned files
This commit is contained in:
@ -21,8 +21,7 @@ class Assert
|
||||
|
||||
public static function thatArgument($name, $condition, $message = self::ARGUMENT_INVALID)
|
||||
{
|
||||
if(!$condition)
|
||||
{
|
||||
if(!$condition) {
|
||||
throw new \InvalidArgumentException(sprintf($message, $name));
|
||||
}
|
||||
}
|
||||
|
@ -27,8 +27,7 @@ class Collection implements \IteratorAggregate, \Countable
|
||||
|
||||
public function addAll($elements)
|
||||
{
|
||||
foreach ($elements as $element)
|
||||
{
|
||||
foreach ($elements as $element) {
|
||||
$this->add($element);
|
||||
}
|
||||
}
|
||||
|
@ -17,35 +17,34 @@ namespace Bundle\WebServiceBundle\Util;
|
||||
*/
|
||||
class String
|
||||
{
|
||||
/**
|
||||
* Checks if a string starts with a given string.
|
||||
*
|
||||
* @param string $str A string
|
||||
* @param string $substr A string to check against
|
||||
*
|
||||
* @return bool True if str starts with substr
|
||||
*/
|
||||
public static function startsWith($str, $substr)
|
||||
{
|
||||
if(is_string($str) && is_string($substr) && strlen($str) >= strlen($substr))
|
||||
/**
|
||||
* Checks if a string starts with a given string.
|
||||
*
|
||||
* @param string $str A string
|
||||
* @param string $substr A string to check against
|
||||
*
|
||||
* @return bool True if str starts with substr
|
||||
*/
|
||||
public static function startsWith($str, $substr)
|
||||
{
|
||||
return $substr == substr($str, 0, strlen($substr));
|
||||
if(is_string($str) && is_string($substr) && strlen($str) >= strlen($substr)) {
|
||||
return $substr == substr($str, 0, strlen($substr));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a string ends with a given string.
|
||||
*
|
||||
* @param string $str A string
|
||||
* @param string $substr A string to check against
|
||||
*
|
||||
* @return bool True if str ends with substr
|
||||
*/
|
||||
public static function endsWith($str, $substr)
|
||||
{
|
||||
if(is_string($str) && is_string($substr) && strlen($str) >= strlen($substr))
|
||||
/**
|
||||
* Checks if a string ends with a given string.
|
||||
*
|
||||
* @param string $str A string
|
||||
* @param string $substr A string to check against
|
||||
*
|
||||
* @return bool True if str ends with substr
|
||||
*/
|
||||
public static function endsWith($str, $substr)
|
||||
{
|
||||
return $substr == substr($str, strlen($str) - strlen($substr));
|
||||
if(is_string($str) && is_string($substr) && strlen($str) >= strlen($substr))
|
||||
{
|
||||
return $substr == substr($str, strlen($str) - strlen($substr));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user