Beispiel #1
0
 public function getResource($controllerClass)
 {
     $ref = new \ReflectionClass($controllerClass);
     //Not a private resource
     if (!$ref->implementsInterface('Eva\\EvaEngine\\Mvc\\Controller\\TokenAuthorityControllerInterface') && !$ref->implementsInterface('Eva\\EvaEngine\\Mvc\\Controller\\SessionAuthorityControllerInterface')) {
         return false;
     }
     $resourceGroup = 'app';
     if ($ref->implementsInterface('Eva\\EvaEngine\\Mvc\\Controller\\TokenAuthorityControllerInterface')) {
         $resourceGroup = 'api';
     } else {
         if ($ref->isSubclassOf('Eva\\EvaEngine\\Mvc\\Controller\\AdminControllerBase')) {
             $resourceGroup = 'admin';
         }
     }
     $reader = new \Phalcon\Annotations\Adapter\Memory();
     $reflector = $reader->get($controllerClass);
     $resourceAnnotations = $reflector->getClassAnnotations();
     $resourceName = $controllerClass;
     $resourceDes = '';
     if ($resourceAnnotations && $resourceAnnotations->has('resourceName') && ($annotation = $resourceAnnotations->get('resourceName'))) {
         $resourceName = implode('', $annotation->getArguments());
     }
     if ($resourceAnnotations && $resourceAnnotations->has('resourceDescription') && ($annotation = $resourceAnnotations->get('resourceDescription'))) {
         $resourceDes = implode('', $annotation->getArguments());
     }
     $resource = array('name' => $resourceName, 'resourceKey' => $controllerClass, 'resourceGroup' => $resourceGroup, 'description' => $resourceDes);
     return $resource;
 }
Beispiel #2
0
 /**
  * @coversNothing
  */
 public function test_aspects()
 {
     $subject = new \ReflectionClass(testSubject::class);
     self::assertFalse($subject->implementsInterface(P\CollectionInterface::class));
     self::assertTrue($subject->implementsInterface(P\UnaryApplicativeInterface::class));
     self::assertTrue($subject->getMethod('of')->isAbstract());
 }
Beispiel #3
0
 public function load()
 {
     $files = $this->_getFiles();
     $manifestRegistry = ZendL_Tool_Rpc_Manifest_Registry::getInstance();
     $providerRegistry = ZendL_Tool_Rpc_Provider_Registry::getInstance();
     $classesLoadedBefore = get_declared_classes();
     $oldLevel = error_reporting(E_ALL | ~E_STRICT);
     // remove strict so that other packages wont throw warnings
     foreach ($files as $file) {
         require_once $file;
     }
     error_reporting($oldLevel);
     // restore old error level
     $classesLoadedAfter = get_declared_classes();
     $loadedClasses = array_diff($classesLoadedAfter, $classesLoadedBefore);
     foreach ($loadedClasses as $loadedClass) {
         $reflectionClass = new ReflectionClass($loadedClass);
         if ($reflectionClass->implementsInterface('ZendL_Tool_Rpc_Manifest_Interface') && !$reflectionClass->isAbstract()) {
             $manifestRegistry->addManifest($reflectionClass->newInstance());
         }
         if ($reflectionClass->implementsInterface('ZendL_Tool_Rpc_Provider_Interface') && !$reflectionClass->isAbstract()) {
             $providerRegistry->addProvider($reflectionClass->newInstance());
         }
     }
 }
 /**
  * @covers \PHP\Manipulator\TokenContainer
  */
 public function testContainer()
 {
     $reflection = new \ReflectionClass('PHP\\Manipulator\\TokenContainer');
     $this->assertTrue($reflection->implementsInterface('ArrayAccess'), 'Missing interface ArrayAccess');
     $this->assertTrue($reflection->implementsInterface('Countable'), 'Missing interface Countable');
     $this->assertTrue($reflection->implementsInterface('IteratorAggregate'), 'Missing interface IteratorAggregate');
 }
Beispiel #5
0
 /**
  * Generates a new class with the given class name
  *
  * @param string $newClassName - The name of the new class
  * @param string $mockedClassName - The name of the class being mocked
  * @param Phake_Mock_InfoRegistry $infoRegistry
  * @return NULL
  */
 public function generate($newClassName, $mockedClassName, Phake_Mock_InfoRegistry $infoRegistry)
 {
     $extends = '';
     $implements = '';
     $interfaces = array();
     $constructor = '';
     $mockedClass = new ReflectionClass($mockedClassName);
     if (!$mockedClass->isInterface()) {
         $extends = "extends {$mockedClassName}";
     } elseif ($mockedClassName != 'Phake_IMock') {
         $implements = ", {$mockedClassName}";
         if ($mockedClass->implementsInterface('Traversable') && !$mockedClass->implementsInterface('Iterator') && !$mockedClass->implementsInterface('IteratorAggregate')) {
             if ($mockedClass->getName() == 'Traversable') {
                 $implements = ', Iterator';
             } else {
                 $implements = ', Iterator' . $implements;
             }
             $interfaces = array('Iterator');
         }
     }
     $classDef = "\nclass {$newClassName} {$extends}\n\timplements Phake_IMock {$implements}\n{\n    public \$__PHAKE_info;\n\n    public static \$__PHAKE_staticInfo;\n\n\tconst __PHAKE_name = '{$mockedClassName}';\n\n\tpublic \$__PHAKE_constructorArgs;\n\n\t{$constructor}\n\n\t/**\n\t * @return void\n\t */\n\tpublic function __destruct() {}\n\n \t{$this->generateSafeConstructorOverride($mockedClass)}\n\n\t{$this->generateMockedMethods($mockedClass, $interfaces)}\n}\n";
     $this->loader->loadClassByString($newClassName, $classDef);
     $newClassName::$__PHAKE_staticInfo = $this->createMockInfo($mockedClassName, new Phake_CallRecorder_Recorder(), new Phake_Stubber_StubMapper(), new Phake_Stubber_Answers_NoAnswer());
     $infoRegistry->addInfo($newClassName::$__PHAKE_staticInfo);
 }
Beispiel #6
0
 /**
  * Instantiates objects by class and id, respecting pattern implemented by given class
  * 
  * @param string $class Class name
  * @param $id
  * @return unknown_type
  */
 public static function instantiate($class, $id = null)
 {
     if (!strlen($class)) {
         require_once 'Oops/Exception.php';
         throw new Oops_Exception("Empty class name given");
     }
     if (!Oops_Loader::find($class)) {
         require_once 'Oops/Exception.php';
         throw new Oops_Exception("Class '{$class}' not found");
     }
     $reflectionClass = new ReflectionClass($class);
     if ($reflectionClass->implementsInterface('Oops_Pattern_Identifiable_Factored_Interface')) {
         /**
          * Object can be instantiated using corresponding factory
          */
         $factoryCallback = call_user_func($class, 'getFactoryCallback');
         $result = call_user_func($factoryCallback, $id);
     } elseif ($reflectionClass->implementsInterface('Oops_Pattern_Identifiable_Singleton_Interface')) {
         /**
          * This object can be instantiated using $class::getInstance($id)
          */
         $result = call_user_func(array($class, 'getInstance'), $id);
     } elseif ($reflectionClass->implementsInterface('Oops_Pattern_Singleton_Interface')) {
         /**
          * This object is the single available instance of this class, so it can be instantiated using $class::getInstance()
          */
         $result = call_user_func(array($class, 'getInstance'));
     } else {
         /**
          * This type of object should be constructed with given $id
          */
         $result = $reflectionClass->newInstance($id);
     }
     return $result;
 }
 /**
  * Resolve bundle dependencies.
  *
  * Given a set of already loaded bundles and a set of new needed bundles,
  * build new dependencies and fill given array of loaded bundles.
  *
  * @param \Symfony\Component\HttpKernel\KernelInterface $kernel         Kernel
  * @param array                                         $bundleStack    Bundle stack, defined by Instance or Namespace
  * @param array                                         $visitedBundles Visited bundles, defined by their namespaces
  * @param array                                         $bundles        New bundles to check, defined by Instance or Namespace
  */
 private function resolveBundleDependencies(\Symfony\Component\HttpKernel\KernelInterface $kernel, array &$bundleStack, array &$visitedBundles, array $bundles)
 {
     $bundles = array_reverse($bundles);
     foreach ($bundles as $bundle) {
         /**
          * Each visited node is prioritized and placed at the beginning.
          */
         $this->prioritizeBundle($bundleStack, $bundle);
     }
     foreach ($bundles as $bundle) {
         $bundleNamespace = $this->getBundleDefinitionNamespace($bundle);
         /**
          * If have already visited this bundle, continue. One bundle can be
          * processed once.
          */
         if (isset($visitedBundles[$bundleNamespace])) {
             continue;
         }
         $visitedBundles[$bundleNamespace] = true;
         $bundleNamespaceObj = new \ReflectionClass($bundleNamespace);
         if ($bundleNamespaceObj->implementsInterface('Elcodi\\Bundle\\CoreBundle\\Interfaces\\DependentBundleInterface') || $bundleNamespaceObj->implementsInterface('Mmoreram\\SymfonyBundleDependencies\\DependentBundleInterface')) {
             /**
              * @var \Elcodi\Bundle\CoreBundle\Interfaces\DependentBundleInterface|string $bundleNamespace
              */
             $bundleDependencies = $bundleNamespace::getBundleDependencies($kernel);
             $this->resolveBundleDependencies($kernel, $bundleStack, $visitedBundles, $bundleDependencies);
         }
     }
 }
 /**
  * @covers \PHP\Manipulator\TokenContainer\Iterator
  */
 public function testIteratorClass()
 {
     $reflection = new \ReflectionClass('PHP\\Manipulator\\TokenContainer\\Iterator');
     $this->assertTrue($reflection->isIterateable());
     $this->assertTrue($reflection->implementsInterface('SeekableIterator'));
     $this->assertTrue($reflection->implementsInterface('Countable'));
     $this->assertTrue($reflection->hasMethod('previous'));
 }
 /**
  * @param string $classname
  *
  * @throws InvalidArgumentException
  */
 public function __construct($classname, StrategyInterface $strategy)
 {
     $this->class = new \ReflectionClass($classname);
     $this->strategy = $strategy;
     if (!$this->class->implementsInterface(self::BALANCER_INTERFACE)) {
         throw new \InvalidArgumentException();
     }
 }
 /**
  * @param string $classname
  *
  * @throws InvalidArgumentException
  */
 public function __construct($classname)
 {
     $this->class = new \ReflectionClass($classname);
     /* */
     if (!$this->class->implementsInterface(self::LOCATION_INTERFACE)) {
         throw new \InvalidArgumentException();
     }
 }
Beispiel #11
0
 /**
  * Reference factory constructor
  *
  * @param string $className
  */
 public function __construct($className = 'EcomDev\\Compiler\\Storage\\Reference')
 {
     $this->reflection = new \ReflectionClass($className);
     $interface = 'EcomDev\\Compiler\\Storage\\ReferenceInterface';
     if (!$this->reflection->implementsInterface($interface)) {
         throw new \InvalidArgumentException(sprintf('%s does not implement %s', $className, $interface));
     }
 }
Beispiel #12
0
 /**
  * Creates a new defer object
  * @param array  $data   The data to set the properties to, as an array
  * @param string $object The full class name of the class to load. The class must implement Deferrable
  */
 public function __construct($data, $object)
 {
     $this->data = $data;
     $this->reflection = new \ReflectionClass($object);
     if (!$this->reflection->implementsInterface(__NAMESPACE__ . '\\Deferrable')) {
         throw new \LogicException($object . ' should implement Deferrable');
     }
 }
 /**
  * @param \ReflectionClass $class
  * @return \Metadata\ClassMetadata
  */
 public function loadMetadataForClass(\ReflectionClass $class)
 {
     if ($class->implementsInterface('Prezent\\Doctrine\\Translatable\\TranslatableInterface')) {
         return $this->loadTranslatableMetadata($class->name, $this->readMapping($class->name));
     }
     if ($class->implementsInterface('Prezent\\Doctrine\\Translatable\\TranslationInterface')) {
         return $this->loadTranslationMetadata($class->name, $this->readMapping($class->name));
     }
 }
Beispiel #14
0
 private function getModuleType(\ReflectionClass $reflected)
 {
     if ($reflected->implementsInterface('Thelia\\Module\\DeliveryModuleInterface')) {
         return BaseModule::DELIVERY_MODULE_TYPE;
     } elseif ($reflected->implementsInterface('Thelia\\Module\\PaymentModuleInterface')) {
         return BaseModule::PAYMENT_MODULE_TYPE;
     } else {
         return BaseModule::CLASSIC_MODULE_TYPE;
     }
 }
Beispiel #15
0
 /**
  * @return MetadataMinerInterface
  * @throws \InvalidArgumentException
  */
 public function create()
 {
     if ($this->oreClass->implementsInterface(MetadataMiner::GHOST_ENTITY_INTERFACE)) {
         $miner = new GhostMetadataMiner($this->metadataCache);
     } elseif ($this->oreClass->implementsInterface(MetadataMiner::RESOURCE_ENTITY_INTERFACE)) {
         $miner = new EntityMetadataMiner($this->metadataCache, $this->resourceClassPath);
     } else {
         throw new \InvalidArgumentException(self::ERROR_RESOURCE_ENTITY_EXPECTED);
     }
     return $miner;
 }
 /**
  * @param string $aggregateType
  */
 function __construct($aggregateType)
 {
     if (null === $aggregateType) {
         throw new \InvalidArgumentException("Aggregate type not set.");
     }
     $this->reflectionClass = new \ReflectionClass($aggregateType);
     if (!$this->reflectionClass->implementsInterface(EventSourcedAggregateRootInterface::class)) {
         throw new \InvalidArgumentException("The given aggregateType must be a subtype of EventSourcedAggregateRootInterface");
     }
     $this->aggregateType = $aggregateType;
     $this->typeIdentifier = $this->reflectionClass->getName();
 }
 function main()
 {
     $i = new ReflectionClass('IFace');
     $ni = new ReflectionClass('N\\IFace');
     $ti = new ReflectionClass('\\T\\IFace');
     var_dump($i->implementsInterface('IfAcE'));
     var_dump($ni->implementsInterface('\\N\\IfAcE'));
     var_dump($ti->implementsInterface('T\\IfAcE'));
     var_dump($i->implementsInterface('N\\Iface'));
     var_dump($ti->implementsInterface('N\\Iface'));
     var_dump($ni->implementsInterface('Iface'));
 }
 protected function injectKnownDependencies(Definition $definition)
 {
     $class = $definition->getClass();
     $r = new \ReflectionClass($class);
     if ($r->implementsInterface('RP\\CommonBundle\\CommandBus\\CommandHandler\\EntityManagerAwareInterface')) {
         $definition->addMethodCall('setEntityManager', [new Reference('doctrine.orm.default_entity_manager')]);
     }
     if ($r->implementsInterface('RP\\CommonBundle\\CommandBus\\CommandHandler\\CommandBusAwareInterface')) {
         $definition->addMethodCall('setCommandBus', [new Reference('rp.command_bus')]);
     }
     if ($r->implementsInterface('RP\\CommonBundle\\CommandBus\\CommandHandler\\EventDispatcherAwareInterface')) {
         $definition->addMethodCall('setEventDispatcher', [new Reference('event_dispatcher')]);
     }
 }
Beispiel #19
0
 /**
  * @param \ReflectionClass $reflection
  * @return object
  * @throws InjectorException
  */
 public function create(\ReflectionClass $reflection)
 {
     //        $reflection = new \ReflectionClass($class);
     $constructor = $reflection->getConstructor();
     $dependencies = $this->injectByFunctionArguments($constructor->getParameters());
     if (!$reflection->implementsInterface(Injectable::class)) {
         throw new InjectorException("Object could not be injected");
     }
     if ($reflection->implementsInterface(SingletonInterface::class)) {
         return $reflection->getMethod("getInstance")->invokeArgs(null, $dependencies);
     } else {
         return $reflection->newInstanceArgs($dependencies);
     }
 }
Beispiel #20
0
 public function getItemConfig($name = null, array $config = [])
 {
     if (!isset($config['class'])) {
         $config['class'] = $this->getItemClass($name, $config) ?: get_called_class();
     }
     $class = new \ReflectionClass($config['class']);
     if ($class->implementsInterface('hiqdev\\yii2\\collection\\ItemWithNameInterface')) {
         $config['name'] = $name;
     }
     if ($class->implementsInterface('hiqdev\\yii2\\collection\\ItemWithCollectionInterface')) {
         $config['collection'] = $this;
     }
     return $config;
 }
 public function process(ContainerBuilder $container)
 {
     if (!$container->hasAlias('logger') || !$container->hasAlias('translator')) {
         return;
     }
     if ($container->getParameter('translator.logging')) {
         $translatorAlias = $container->getAlias('translator');
         $definition = $container->getDefinition((string) $translatorAlias);
         $class = $container->getParameterBag()->resolveValue($definition->getClass());
         $refClass = new \ReflectionClass($class);
         if ($refClass->implementsInterface('Symfony\\Component\\Translation\\TranslatorInterface') && $refClass->implementsInterface('Symfony\\Component\\Translation\\TranslatorBagInterface')) {
             $container->getDefinition('translator.logging')->setDecoratedService('translator');
         }
     }
 }
 /**
  * {@inheritdoc}
  */
 protected function addRepository(ContainerBuilder $container, MetadataInterface $metadata)
 {
     $reflection = new \ReflectionClass($metadata->getClass('model'));
     $translatableInterface = TranslatableInterface::class;
     $translatable = interface_exists($translatableInterface) && $reflection->implementsInterface($translatableInterface);
     $repositoryClassParameterName = sprintf('%s.repository.%s.class', $metadata->getApplicationName(), $metadata->getName());
     $repositoryClass = $translatable ? TranslatableResourceRepository::class : EntityRepository::class;
     if ($container->hasParameter($repositoryClassParameterName)) {
         $repositoryClass = $container->getParameter($repositoryClassParameterName);
     }
     if ($metadata->hasClass('repository')) {
         $repositoryClass = $metadata->getClass('repository');
     }
     $repositoryReflection = new \ReflectionClass($repositoryClass);
     $definition = new Definition($repositoryClass);
     $definition->setArguments([new Reference($metadata->getServiceId('manager')), $this->getClassMetadataDefinition($metadata)]);
     $definition->setLazy(!$repositoryReflection->isFinal());
     if ($metadata->hasParameter('translation')) {
         $translatableRepositoryInterface = TranslatableResourceRepositoryInterface::class;
         $translationConfig = $metadata->getParameter('translation');
         if (interface_exists($translatableRepositoryInterface) && $repositoryReflection->implementsInterface($translatableRepositoryInterface)) {
             if (isset($translationConfig['fields'])) {
                 $definition->addMethodCall('setTranslatableFields', [$translationConfig['fields']]);
             }
         }
     }
     $container->setDefinition($metadata->getServiceId('repository'), $definition);
 }
 public function process(ContainerBuilder $container)
 {
     if (!$container->hasDefinition($this->dispatcherService)) {
         return;
     }
     $definition = $container->getDefinition($this->dispatcherService);
     foreach ($container->findTaggedServiceIds($this->listenerTag) as $id => $events) {
         foreach ($events as $event) {
             $priority = isset($event['priority']) ? $event['priority'] : 0;
             if (!isset($event['event'])) {
                 throw new \InvalidArgumentException(sprintf('Service "%s" must define the "event" attribute on "kernel.event_listener" tags.', $id));
             }
             if (!isset($event['method'])) {
                 $event['method'] = 'on' . preg_replace_callback(array('/(?<=\\b)[a-z]/i', '/[^a-z0-9]/i'), function ($matches) {
                     return strtoupper($matches[0]);
                 }, $event['event']);
                 $event['method'] = preg_replace('/[^a-z0-9]/i', '', $event['method']);
             }
             $definition->addMethodCall('addListenerService', array($event['event'], array($id, $event['method']), $priority));
         }
     }
     foreach ($container->findTaggedServiceIds($this->subscriberTag) as $id => $attributes) {
         // We must assume that the class value has been correctly filled, even if the service is created by a factory
         $class = $container->getDefinition($id)->getClass();
         $refClass = new \ReflectionClass($class);
         $interface = 'Symfony\\Component\\EventDispatcher\\EventSubscriberInterface';
         if (!$refClass->implementsInterface($interface)) {
             throw new \InvalidArgumentException(sprintf('Service "%s" must implement interface "%s".', $id, $interface));
         }
         $definition->addMethodCall('addSubscriberService', array($id, $class));
     }
 }
 public static function modelHasStarredInterface($modelClassName, $reflectionClass = null)
 {
     if (!isset($reflectionClass)) {
         $reflectionClass = new ReflectionClass($modelClassName);
     }
     return $reflectionClass->implementsInterface('StarredInterface');
 }
Beispiel #25
0
 private function buildTypeMap($paths)
 {
     global $prefs;
     $cacheKey = 'fieldtypes.' . $prefs['language'];
     if ($this->getPreCacheTypeMap()) {
         return;
     }
     $cachelib = TikiLib::lib('cache');
     if ($data = $cachelib->getSerialized($cacheKey)) {
         $this->typeMap = $data['typeMap'];
         $this->infoMap = $data['infoMap'];
         $this->setPreCacheTypeMap($data);
         return;
     }
     foreach ($paths as $path => $prefix) {
         foreach (glob("{$path}/*.php") as $file) {
             if ($file === "{$path}/index.php") {
                 continue;
             }
             $class = $prefix . substr($file, strlen($path) + 1, -4);
             $reflected = new ReflectionClass($class);
             if ($reflected->isInstantiable() && $reflected->implementsInterface('Tracker_Field_Interface')) {
                 $providedFields = call_user_func(array($class, 'getTypes'));
                 foreach ($providedFields as $key => $info) {
                     $this->typeMap[$key] = $class;
                     $this->infoMap[$key] = $info;
                 }
             }
         }
     }
     uasort($this->infoMap, array($this, 'compareName'));
     $data = array('typeMap' => $this->typeMap, 'infoMap' => $this->infoMap);
     $cachelib->cacheItem($cacheKey, serialize($data));
     $this->setPreCacheTypeMap($data);
 }
 /**
  * Set which class should be used to instantiate this list's items.
  * Pass null to revert back to the default class: KeyValue.
  *
  * @param null|string|\ReflectionClass $class Fully-qualified class name or ReflectionClass.
  *
  * @return AbstractList self
  * @throws \RuntimeException If class does not implement minimum interface.
  */
 public function setItemClass($class)
 {
     if (!$class) {
         $this->_itemClass = null;
         return $this;
     }
     if ($class instanceof \ReflectionClass) {
         $this->_itemClass = $class;
     } else {
         $this->_itemClass = new \ReflectionClass($class);
     }
     if (!$this->_itemClass->implementsInterface(self::$minimumItemInterface)) {
         throw new \RuntimeException('Item classes must implement ' . self::$minimumItemInterface);
     }
     return $this;
 }
Beispiel #27
0
 public static function isInteractor($className)
 {
     $reflection = new \ReflectionClass($className);
     if (!$reflection->implementsInterface('PhpInteractor\\InteractorInterface')) {
         throw new NonInteractorException($className);
     }
 }
Beispiel #28
0
 /**
  * 入口函数,初始化路由器
  *
  * @access public
  * @return void
  * @throws Typecho_Widget_Exception
  */
 public function execute()
 {
     /** 验证路由地址 **/
     $action = $this->request->action;
     //兼容老版本
     if (empty($action)) {
         $widget = trim($this->request->widget, '/');
         $objectName = 'Widget_' . str_replace('/', '_', $widget);
         if (Typecho_Common::isAvailableClass($objectName)) {
             $widgetName = $objectName;
         }
     } else {
         /** 判断是否为plugin */
         $actionTable = array_merge($this->_map, unserialize($this->widget('Widget_Options')->actionTable));
         if (isset($actionTable[$action])) {
             $widgetName = $actionTable[$action];
         }
     }
     if (isset($widgetName) && class_exists($widgetName)) {
         $reflectionWidget = new ReflectionClass($widgetName);
         if ($reflectionWidget->implementsInterface('Widget_Interface_Do')) {
             $this->widget($widgetName)->action();
             return;
         }
     }
     throw new Typecho_Widget_Exception(_t('请求的地址不存在'), 404);
 }
Beispiel #29
0
 /**
  * Generates and checks presenter class name.
  * @param  string  presenter name
  * @return string  class name
  * @throws InvalidPresenterException
  */
 public function getPresenterClass(&$name)
 {
     if (isset($this->cache[$name])) {
         return $this->cache[$name];
     }
     if (!is_string($name) || !Nette\Utils\Strings::match($name, '#^[a-zA-Z\\x7f-\\xff][a-zA-Z0-9\\x7f-\\xff:]*\\z#')) {
         throw new InvalidPresenterException("Presenter name must be alphanumeric string, '{$name}' is invalid.");
     }
     $class = $this->formatPresenterClass($name);
     if (!class_exists($class)) {
         throw new InvalidPresenterException("Cannot load presenter '{$name}', class '{$class}' was not found.");
     }
     $reflection = new \ReflectionClass($class);
     $class = $reflection->getName();
     if (!$reflection->implementsInterface('Nette\\Application\\IPresenter')) {
         throw new InvalidPresenterException("Cannot load presenter '{$name}', class '{$class}' is not Nette\\Application\\IPresenter implementor.");
     } elseif ($reflection->isAbstract()) {
         throw new InvalidPresenterException("Cannot load presenter '{$name}', class '{$class}' is abstract.");
     }
     $this->cache[$name] = $class;
     if ($name !== ($realName = $this->unformatPresenterClass($class))) {
         trigger_error("Case mismatch on presenter name '{$name}', correct name is '{$realName}'.", E_USER_WARNING);
         $name = $realName;
     }
     return $class;
 }
 /**
  * @return array
  * @throws RokCommon_Exception
  */
 protected function getOptions()
 {
     $options = array();
     if (isset($this->xmlnode['populator'])) {
         $populator_class = trim((string) $this->xmlnode['populator']);
         if (!class_exists($populator_class, true)) {
             throw new RokCommon_Exception(rc__('Cannot find class %s', $populator_class));
         }
         $rtclass = new ReflectionClass($populator_class);
         if (!$rtclass->implementsInterface('RokCommon_Filter_IPicklistPopulator')) {
             throw new RokCommon_Exception(rc__('%s does not implement the %s interface', $populator_class, 'RokCommon_Filter_IPicklistPopulator'));
         }
         /** @var $populator  RokCommon_Filter_IPicklistPopulator */
         $populator = new $populator_class();
         $populator_options = $populator->getPicklistOptions();
         if (is_array($populator_options)) {
             $options = array_diff_key($options, $populator_options) + $populator_options;
         }
     }
     $option_node = $this->xmlnode->xpath('option');
     foreach ($option_node as $option) {
         $options[trim((string) $option['value'])] = trim((string) $option);
     }
     return $options;
 }