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; }
/** * @test */ public function shouldCheckIsStringContainsSubstring() { //given $string = 'Fear cuts deeper than swords'; //when $contains = Strings::contains($string, 'deeper'); //then $this->assertTrue($contains); }
/** * @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(), '__'); }
public static function isReflectionType($types) { return Strings::contains($types, 'className'); }
public function isActionExists($actionName) { return Strings::contains($this->getControllerContents(), 'function ' . $actionName); }