for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Rj\FrontendBundle\Util;
class Util
{
/**
* @param string $subject
*
* @return bool
*/
public static function containsNotUrl($subject)
return static::containsUrl($subject, true);
}
* @param bool $negate
public static function containsUrl($subject, $negate = false)
if (is_string($subject)) {
$subject = [$subject];
$flags = $negate ? PREG_GREP_INVERT : null;
$result = preg_grep('|^(https?:)?//|', $subject, $flags);
return !empty($result);