/** * @param \ReflectionMethod $method * @return bool */ private function isAutoloadMethod(\ReflectionMethod $method) { if (strpos($method->getName(), KnotConsts::AUTOLOAD_METHOD_PREFIX) !== 0 || $method->getNumberOfParameters() != 1 || $method->getNumberOfRequiredParameters() != 1 || $method->isStatic() || $method->isAbstract() || !Extractor::instance()->has($method, KnotConsts::AUTOLOAD_ANNOTATIONS)) { return false; } return true; }
/** * @param int $originalFlag * @param string $className * @return int */ private function getFlagFromClass($originalFlag, $className) { if (Extractor::instance()->has($className, 'static')) { return Type::ByValue; } if (Extractor::instance()->has($className, 'unique')) { return Type::Singleton; } return $originalFlag; }
/** * @param \ReflectionProperty $property * @param mixed $instance */ private function loadProperty(\ReflectionProperty $property, $instance) { $type = Extractor::instance()->get($property, KnotConsts::VARIABLE_DECLARATION_ANNOTATION); if (!$type) { throw new \Exception('Variable autoload is configured but missing it\'s type: ' . $property->name); } $type = $this->getFullTypeName($property, $type); $value = $this->getSkeleton()->get($type); $property->setValue($instance, $value); }
/** * @param \ReflectionClass $reflection * @return bool */ private function isAutoloadClass(\ReflectionClass $reflection) { return Extractor::instance()->has($reflection, KnotConsts::AUTOLOAD_ANNOTATIONS); }