contains() public static method

Checks if string contains the substring.
public static contains ( string $string, string $substring ) : boolean
$string string
$substring string
return boolean
Ejemplo n.º 1
0
 public function getMetadata($instance)
 {
     $class = new ReflectionClass($instance);
     $properties = $class->getProperties();
     $annotations = array();
     foreach ($properties as $property) {
         $doc = $property->getDocComment();
         if (Strings::contains($doc, '@Inject')) {
             if (preg_match("#@var ([\\\\A-Za-z0-9]*)#s", $doc, $matched)) {
                 $className = $matched[1];
                 $name = $this->extractName($doc);
                 $annotations[$property->getName()] = array('name' => $name, 'className' => $className);
             } else {
                 throw new InjectorException('Cannot @Inject dependency. @var is not defined for property $' . $property->getName() . ' in class ' . $class->getName() . '.');
             }
         }
     }
     return $annotations;
 }
Ejemplo n.º 2
0
 /**
  * @test
  */
 public function shouldCheckIsStringContainsSubstring()
 {
     //given
     $string = 'Fear cuts deeper than swords';
     //when
     $contains = Strings::contains($string, 'deeper');
     //then
     $this->assertTrue($contains);
 }
Ejemplo n.º 3
0
 /**
  * @param ReflectionMethod $method
  * @return bool
  */
 private function canParseMethod(ReflectionMethod $method)
 {
     return Strings::contains($method->getDocComment(), '@WebMethod') && $method->isPublic() && !$method->isConstructor() && !$method->isDestructor() && !Strings::contains($method->getName(), '__');
 }
Ejemplo n.º 4
0
 public static function isReflectionType($types)
 {
     return Strings::contains($types, 'className');
 }
Ejemplo n.º 5
0
 public function isActionExists($actionName)
 {
     return Strings::contains($this->getControllerContents(), 'function ' . $actionName);
 }