コード例 #1
0
ファイル: ExtensionManager.php プロジェクト: g4z/poop
 /**
  * Load all extension classes
  */
 public function load()
 {
     $counter = 0;
     foreach (glob(__DIR__ . '/Extension/*.php') as $filename) {
         $file = new \SplFileInfo($filename);
         $classname = $file->getBasename('.php');
         $classpath = sprintf('%s\\Extension\\%s', __NAMESPACE__, $classname);
         require_once $filename;
         $extension = new \ReflectionClass($classpath);
         $instance = $extension->newInstance($this->getParent());
         foreach ($extension->getMethods() as $method) {
             if (mb_substr($method->name, 0, 3) == 'FN_') {
                 $map = new \StdClass();
                 $map->class = $extension->getShortName();
                 $map->method = $method->name;
                 $map->instance = $instance;
                 $tag = sprintf('%s.%s', mb_strtolower($classname), mb_substr($method->name, 3));
                 $this->mapping[$tag] = $map;
             }
         }
         $this->debug(__METHOD__, __LINE__, sprintf('Loaded extension: %s', $extension->getShortName()));
         // save the instance
         $this->instances[] = $instance;
         $counter++;
     }
     return $counter;
 }
コード例 #2
0
ファイル: BuildSearchIndex.php プロジェクト: dw250100785/Octo
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     unset($input);
     $items = glob(CMS_PATH . '*/Model/*.php');
     foreach ($items as $item) {
         $model = str_replace([CMS_BASE_PATH, '/', '.php'], ['', '\\', ''], $item);
         $systemModels[] = $model;
     }
     foreach (glob(APP_PATH . "*", GLOB_ONLYDIR) as $path) {
         $items = glob($path . '/*/Model/*.php');
         foreach ($items as $item) {
             $model = str_replace([APP_PATH, '/', '.php'], ['', '\\', ''], $item);
             $systemModels[] = $model;
         }
     }
     foreach ($systemModels as $model) {
         $myModel = new $model();
         if (method_exists($myModel, 'getIndexableContent')) {
             $reflect = new \ReflectionClass($myModel);
             $myStore = Store::get($reflect->getShortName());
             $modelsToIndex = $myStore->getModelsToIndex();
             $output->write('Indexing: ' . $reflect->getShortName());
             $count = 0;
             foreach ($modelsToIndex as $newModel) {
                 $count++;
                 $content = $newModel->getIndexableContent();
                 $data = ['model' => $newModel, 'content_id' => $newModel->getId(), 'content' => $content];
                 Event::trigger('ContentPublished', $data);
             }
             $output->writeln(' (' . $count . ' items)');
         }
     }
 }
コード例 #3
0
 /**
  * @param array            $config
  * @param \ReflectionClass $class
  *
  * @return Resource
  */
 protected function parseResource(array $config, \ReflectionClass $class)
 {
     if (isset($config['resource'])) {
         $resource = $config['resource'];
         return new Resource(isset($resource['type']) ? $resource['type'] : StringUtil::dasherize($class->getShortName()), isset($resource['showLinkSelf']) ? $resource['showLinkSelf'] : null);
     }
     return new Resource(StringUtil::dasherize($class->getShortName()));
 }
コード例 #4
0
 /**
  * @return string
  */
 private function getMethodName()
 {
     $methodSuffix = $this->argumentType->getShortName();
     $methodSuffix = ucfirst($methodSuffix);
     $pattern = 'get%sVisitor';
     $methodName = sprintf($pattern, $methodSuffix);
     return $methodName;
 }
コード例 #5
0
 /**
  * Initializes a new ClassMetadata instance that will hold the object-relational mapping
  * metadata of the class with the given name.
  *
  * @param string $entityName The name of the entity class the new instance is used for.
  */
 public function __construct($entityName)
 {
     $this->name = $entityName;
     $this->reflClass = new \ReflectionClass($entityName);
     $this->namespace = $this->reflClass->getNamespaceName();
     $this->primaryTable['name'] = $this->reflClass->getShortName();
     $this->rootEntityName = $entityName;
 }
コード例 #6
0
ファイル: Tile.php プロジェクト: ClearSkyTeam/ClearSky
 /**
  * @param $className
  *
  * @return bool
  */
 public static function registerTile($className)
 {
     $class = new \ReflectionClass($className);
     if (is_a($className, Tile::class, true) and !$class->isAbstract()) {
         self::$knownTiles[$class->getShortName()] = $className;
         self::$shortNames[$className] = $class->getShortName();
         return true;
     }
     return false;
 }
コード例 #7
0
 /**
  * Creates the factory for this concrete product.
  * If the class does not exists yet, it is generated on the fly.
  * 
  * The factory implements an interface named after the short name of the
  * product class name with the suffix "Factory". The namespace is the
  * same namespace as the product classname.
  * 
  * The concrete factory is not of your concern, that's the trick of
  * factory method. That's why I put a random number after the classname
  * of the concrete factory : do not use that name !
  * 
  * @param string $fqcnProduct
  * 
  * @return object the the new factory
  */
 public function getFactory($fqcnProduct)
 {
     $refl = new \ReflectionClass($fqcnProduct);
     $fmName = 'Concrete' . $refl->getShortName() . 'Factory' . crc32($fqcnProduct);
     $fqcnFM = $refl->getNamespaceName() . '\\' . $fmName;
     if (!class_exists($fqcnFM)) {
         eval($this->generate($refl->getNamespaceName(), $refl->getShortName() . 'Factory', $fmName, $refl->getName()));
     }
     return new $fqcnFM();
 }
コード例 #8
0
ファイル: shortcode.php プロジェクト: benedict-w/pressgang
 /**
  * __construct
  *
  */
 public function __construct($template = null, $context = null)
 {
     $class = new \ReflectionClass(get_called_class());
     $shortcode = Helper::camel_to_underscored($class->getShortName());
     if ($template === null) {
         $template = sprintf("%s.twig", Helper::camel_to_hyphenated($class->getShortName()));
     }
     $this->template = $template;
     $this->context = $context;
     add_shortcode($shortcode, array($this, 'do_shortcode'));
 }
コード例 #9
0
 function __construct($aggregateType)
 {
     if (null === $aggregateType) {
         throw new \InvalidArgumentException("Aggregate type not set.");
     }
     $this->reflClass = new \ReflectionClass($aggregateType);
     if (!$this->reflClass->implementsInterface(EventSourcedAggregateRootInterface::class)) {
         throw new \InvalidArgumentException("The given aggregateType must be a subtype of EventSourcedAggregateRootInterface");
     }
     $this->aggregateType = $aggregateType;
     $this->typeIdentifier = $this->reflClass->getShortName();
 }
コード例 #10
0
ファイル: SCanHelper.php プロジェクト: oyoy8629/yii-core
 private function getControllerFile($module)
 {
     $nameSpace = $module->controllerNamespace;
     foreach (new \DirectoryIterator($module->controllerPath) as $file) {
         if (!$file->isDot()) {
             $className = $file->getBasename("Controller.php");
             $class = $nameSpace . '\\' . $className . "Controller";
             if (strpos($class, '-') === false && class_exists($class) && is_subclass_of($class, 'yii\\base\\Controller')) {
                 $class = new \ReflectionClass($class);
                 $doc = DocHelper::getDocComment($class->getDocComment());
                 $this->array[$module->getUniqueId()]['controllers'][str_replace("Controller", "", $class->getShortName())] = ['doc' => $doc ? $doc : $class->getShortName(), 'actions' => $this->getActions($class), 'class' => $class->getName()];
             }
         }
     }
 }
コード例 #11
0
 private function createMockClass($className, $mockData = [])
 {
     $shortName = $this->reflection->getShortName();
     $classStart = self::reflectionContent($this->reflection, 1, $this->reflection->getStartLine() - 1);
     $classStart .= PHP_EOL . "class {$className} extends {$shortName}" . PHP_EOL;
     $this->body = self::reflectionBody($this->reflection, false);
     foreach ($mockData as $attribute => $value) {
         if (is_callable($value)) {
             $this->insertMethod($attribute, $value);
         } else {
             $this->insertAttribute($attribute, $value);
         }
     }
     eval($classStart . $this->body);
 }
コード例 #12
0
 public function indexAction(Request $request)
 {
     try {
         $this->get('naoned.oaipmh.ruler')->checkParamsUnicity($request->getQueryString());
         $this->allArgs = $this->getAllArguments($request);
         if (!array_key_exists('verb', $this->allArgs)) {
             throw new BadVerbException('The verb argument is missing');
         }
         $verb = $this->allArgs['verb'];
         if (!in_array($verb, $this->availableVerbs)) {
             throw new BadVerbException('Value of the verb argument is not a legal OAI-PMH verb.');
         }
         $methodName = $verb . 'Verb';
         return $this->{$methodName}($request);
     } catch (\Exception $e) {
         if ($e instanceof OaiPmhServerException) {
             $reflect = new \ReflectionClass($e);
             //Remove «Exception» at end of class namespace
             $code = substr($reflect->getShortName(), 0, -9);
             // lowercase first char
             $code[0] = strtolower(substr($code, 0, 1));
         } elseif ($e instanceof NotFoundHttpException) {
             $code = 'notFoundError';
         } else {
             $code = 'unknownError';
         }
         return $this->error($code, $e->getMessage());
     }
 }
 /**
  * Get the static content of the widget.
  *
  * @param Widget $widget
  *
  * @return string The static content
  */
 public function getWidgetStaticContent(Widget $widget)
 {
     $parameters = parent::getWidgetStaticContent($widget);
     $currentView = $this->currentViewHelper->getCurrentView();
     if ($currentView instanceof Template) {
         $rating = new Rating();
         $parameters['ratings'] = [];
         $parameters['entityId'] = 0;
         if ($currentView instanceof BusinessTemplate) {
             $parameters['businessEntityId'] = $currentView->getBusinessEntityId();
         }
     } else {
         if ($currentView instanceof BusinessPage) {
             $businessEntityId = $currentView->getBusinessEntityId();
             $entityId = $currentView->getBusinessEntity()->getId();
         } else {
             $ref = new \ReflectionClass($currentView);
             $businessEntityId = strtolower($ref->getShortName());
             $entityId = $currentView->getId();
         }
         $rating = $this->entityManager->getRepository('VictoireWidgetAggregateRatingBundle:Rating')->findOneOrCreate(['ipAddress' => $this->request->getClientIp(), 'businessEntityId' => $businessEntityId, 'entityId' => $entityId]);
         $parameters['ratings'] = $this->entityManager->getRepository('VictoireWidgetAggregateRatingBundle:Rating')->findBy(['businessEntityId' => $businessEntityId, 'entityId' => $entityId]);
         $parameters['businessEntityId'] = $businessEntityId;
         $parameters['entityId'] = $entityId;
     }
     $ratingForm = $this->formFactory->create(new RatingType(), $rating);
     $parameters['ratingForm'] = $ratingForm->createView();
     return $parameters;
 }
コード例 #14
0
 /**
  * Create a new event instance.
  *
  * @return void
  */
 public function __construct($object, $event)
 {
     $reflection = new \ReflectionClass($object);
     $this->class = $reflection->getShortName();
     $this->object = $object;
     $this->event = $event;
 }
コード例 #15
0
ファイル: Dto.php プロジェクト: rettakid-carwash/server-php
 public function bindXmlData($xml, $objClass, $objMthods)
 {
     $obj = new $objClass();
     foreach ($objMthods as $medthod) {
         $methodName = $medthod->getName();
         $displayName = strtolower(ucwords(substr($methodName, 3, strlen($methodName) - 3)));
         $getterName = 'get' . substr($methodName, 3);
         if (substr($methodName, 0, 3) == "set") {
             if (is_array($obj->{$getterName}())) {
                 $dtoName = trim(substr($methodName, 3), "s") . "Dto";
                 $dtoXmlName = strtolower($dtoName);
                 $child = new $dtoName();
                 $className = new ReflectionClass($child);
                 $data = array();
                 foreach ($xml->{$displayName}->{$dtoXmlName} as $childXml) {
                     array_push($data, $this->bindXmlData($childXml, $className->getShortName(), $className->getMethods()));
                 }
             } else {
                 if ($obj->{$getterName}() instanceof Dto) {
                     $className = new ReflectionClass($obj->{$getterName}());
                     $data = $this->bindXmlData($xml->{$displayName}, $className->getShortName(), $className->getMethods());
                 } else {
                     $data = $xml->{$displayName};
                 }
             }
             $obj->{$methodName}($data);
         }
     }
     return $obj;
 }
コード例 #16
0
 /**
  * @param string $sprintfPattern
  * @param \ReflectionClass $argumentType
  *
  * @return string
  */
 private function buildMethodName($sprintfPattern, \ReflectionClass $argumentType)
 {
     $methodSuffix = $argumentType->getShortName();
     $methodSuffix = ucfirst($methodSuffix);
     $methodName = sprintf($sprintfPattern, $methodSuffix);
     return $methodName;
 }
コード例 #17
0
 /**
  * Generate Remote API from a list of controllers
  */
 public function generateRemotingApi()
 {
     $list = array();
     foreach ($this->remotingBundles as $bundle) {
         $bundleRef = new \ReflectionClass($bundle);
         $controllerDir = new Finder();
         $controllerDir->files()->in(dirname($bundleRef->getFileName()) . '/Controller/')->name('/.*Controller\\.php$/');
         foreach ($controllerDir as $controllerFile) {
             /** @var SplFileInfo $controllerFile */
             $controller = $bundleRef->getNamespaceName() . "\\Controller\\" . substr($controllerFile->getFilename(), 0, -4);
             $controllerRef = new \ReflectionClass($controller);
             foreach ($controllerRef->getMethods(\ReflectionMethod::IS_PUBLIC) as $method) {
                 /** @var $methodDirectAnnotation Direct */
                 $methodDirectAnnotation = $this->annoReader->getMethodAnnotation($method, 'Tpg\\ExtjsBundle\\Annotation\\Direct');
                 if ($methodDirectAnnotation !== null) {
                     $nameSpace = str_replace("\\", ".", $bundleRef->getNamespaceName());
                     $className = str_replace("Controller", "", $controllerRef->getShortName());
                     $methodName = str_replace("Action", "", $method->getName());
                     $list[$nameSpace][$className][] = array('name' => $methodName, 'len' => count($method->getParameters()));
                 }
             }
         }
     }
     return $list;
 }
コード例 #18
0
ファイル: Backend.php プロジェクト: bombayworks/currycms
 public function initialize()
 {
     $app = $this->app;
     if ($app['setup']) {
         $this->addView('setup', new Setup($app));
     } else {
         $cacheName = sha1(__CLASS__ . '_backendClasses');
         $backendClasses = $app->cache->load($cacheName);
         if ($backendClasses === false) {
             $backendClasses = array();
             $classes = ClassEnumerator::findClasses(__DIR__ . '/../Backend');
             foreach ($classes as $className) {
                 if (class_exists($className) && $className !== __CLASS__ && $className !== 'Curry\\Backend\\Setup') {
                     $r = new \ReflectionClass($className);
                     if ($r->isSubclassOf('Curry\\Backend\\AbstractBackend') && !$r->isAbstract()) {
                         $backendClasses[strtolower($r->getShortName())] = $className;
                     }
                 }
             }
             $app->cache->save($backendClasses, $cacheName);
         }
         foreach ($backendClasses as $viewName => $className) {
             $this->addView($viewName, new $className($this->app));
         }
     }
 }
コード例 #19
0
 public function parse($symfonyControllerName)
 {
     if (isset($this->cache[$symfonyControllerName])) {
         return $this->cache[$symfonyControllerName];
     }
     // skip controllers as services
     if (strpos($symfonyControllerName, ".") !== false) {
         return array();
     }
     if (substr_count($symfonyControllerName, "::") == 1) {
         $details = array();
         list($controllerName, $actionName) = explode("::", $symfonyControllerName);
         $details['action'] = str_replace("Action", "", $actionName);
         $controllerRefl = new \ReflectionClass($controllerName);
         $details['controller'] = str_replace("Controller", "", $controllerRefl->getShortName());
         $controllerNamespace = $controllerRefl->getNamespaceName();
         foreach ($this->kernel->getBundles() as $bundle) {
             if (strpos($controllerNamespace, $bundle->getNamespace()) === 0) {
                 $details['module'] = str_replace("Bundle", "", $bundle->getName());
                 break;
             }
         }
     } else {
         list($module, $controller, $action) = explode(":", $symfonyControllerName);
         $details['action'] = $action;
         $details['controller'] = $controller;
         $details['module'] = str_replace("Bundle", "", $module);
     }
     return $this->cache[$symfonyControllerName] = $details;
 }
コード例 #20
0
 /**
  * @param  \ReflectionClass|string
  * @return self
  */
 public static function from($from)
 {
     $from = new \ReflectionClass($from instanceof \ReflectionClass ? $from->getName() : $from);
     if (PHP_VERSION_ID >= 70000 && $from->isAnonymous()) {
         $class = new static('anonymous');
     } else {
         $class = new static($from->getShortName(), new PhpNamespace($from->getNamespaceName()));
     }
     $class->type = $from->isInterface() ? 'interface' : (PHP_VERSION_ID >= 50400 && $from->isTrait() ? 'trait' : 'class');
     $class->final = $from->isFinal() && $class->type === 'class';
     $class->abstract = $from->isAbstract() && $class->type === 'class';
     $class->implements = $from->getInterfaceNames();
     $class->documents = $from->getDocComment() ? array(preg_replace('#^\\s*\\* ?#m', '', trim($from->getDocComment(), "/* \r\n\t"))) : array();
     if ($from->getParentClass()) {
         $class->extends = $from->getParentClass()->getName();
         $class->implements = array_diff($class->implements, $from->getParentClass()->getInterfaceNames());
     }
     foreach ($from->getProperties() as $prop) {
         if ($prop->getDeclaringClass()->getName() === $from->getName()) {
             $class->properties[$prop->getName()] = Property::from($prop);
         }
     }
     foreach ($from->getMethods() as $method) {
         if ($method->getDeclaringClass()->getName() === $from->getName()) {
             $class->methods[$method->getName()] = Method::from($method)->setNamespace($class->namespace);
         }
     }
     return $class;
 }
コード例 #21
0
ファイル: OBlood.php プロジェクト: Oblood/framework
 public function __construct()
 {
     /**
      * 实例化容器,并且保存在此载体中
      */
     if (empty(static::$app)) {
         static::$app = new Application();
     }
     /**
      * 通过反射获取所有父类,并且获取他们的类名,通过这些类名来形成构造函数
      * 比如当前类的构造函数为 $this->OBlood()
      * 切记:Application类不能继承此类
      */
     $reflectionClass = new \ReflectionClass($this);
     $constructs[] = $reflectionClass->getShortName();
     $parentClass = $reflectionClass->getParentClass();
     while ($parentClass != false) {
         $constructs[] = $parentClass->getShortName();
         $parentClass = $parentClass->getParentClass();
     }
     /**
      * 这里采用倒叙的方式来进行排列,
      * 主要是以顶级父类为最先执行,一次向下
      */
     rsort($constructs);
     foreach ($constructs as $construct) {
         if (method_exists($this, $construct)) {
             call_user_func_array([$this, $construct], func_get_args());
         }
     }
 }
コード例 #22
0
ファイル: ThrowableInfoFactory.php プロジェクト: n2n/n2n
 public static function createFromException(\Throwable $t)
 {
     $eClass = new \ReflectionClass($t);
     $throwableInfo = new ThrowableInfo($eClass->getShortName(), $eClass->getName(), $t->getFile(), $t->getLine(), self::buildStackTraceString($t));
     $throwableInfo->setMessage($t->getMessage());
     if ($t instanceof EnhancedError) {
         self::applyEnhancedCodeInfo($throwableInfo, $t);
     } else {
         if ($t instanceof \Error) {
             self::applyCodeInfo($throwableInfo, $t);
         } else {
             if ($t instanceof \ErrorException) {
                 self::applyErrorThrowableInfo($throwableInfo, $t);
             }
         }
     }
     if ($t instanceof QueryStumble) {
         self::applyQueryStumble($throwableInfo, $t);
     } else {
         if ($t instanceof \PDOException) {
             self::applyPdoException($throwableInfo, $t);
         }
     }
     if ($t instanceof Documentable) {
         $throwableInfo->setDocumentId($t->getDocumentId());
     }
     return $throwableInfo;
 }
コード例 #23
0
 protected function setUp()
 {
     parent::setUp();
     $reflect = new \ReflectionClass($this);
     $this->classShortName = $reflect->getShortName();
     $this->contentType = $this->createTestContentType();
 }
コード例 #24
0
 /**
  * @param SmartHome $smartHome
  */
 public function __construct(SmartHome $smartHome)
 {
     $this->smartHome = $smartHome;
     $reflectionClass = new \ReflectionClass($this);
     $this->request = new \SimpleXMLElement('<BaseRequest xmlns:xsd="http://www.w3.org/2001/XMLSchema" />');
     $this->request->addAttribute('xsi:type', $reflectionClass->getShortName(), 'http://www.w3.org/2001/XMLSchema-instance');
 }
コード例 #25
0
 protected function getRepo()
 {
     $reflection = new \ReflectionClass(get_class($this));
     $test = $reflection->getShortName();
     $repoClass = 'Infrastructure\\Persistence\\Doctrine\\' . str_replace('Test', '', $test);
     return new $repoClass($this->manager);
 }
コード例 #26
0
ファイル: Router.php プロジェクト: philippgerard/slayer
 private function _getParsedRoutes($target)
 {
     $route_name = null;
     $uses = [];
     if (is_string($target)) {
         $uses = explode('@', $target);
     } elseif (is_array($target)) {
         $route_name = @$target['as'] ?: null;
         if (isset($target['uses'])) {
             $uses = explode('@', $target['uses']);
         }
     }
     # - get the default namespace from the dispatcher
     $default_namespace = $this->getDI()->get('dispatcher')->getDefaultNamespace() . '\\';
     # - if the uses is not empty, we should get the class properties
     # such as namespace, class short name
     if (!empty($uses)) {
         $reflection = new \ReflectionClass($default_namespace . $uses[0]);
         # - let's get the reflected class namespace
         $namespace = $reflection->getNamespaceName();
         # - this strips out all the word 'Controller'
         # and then getting the reflected class short name
         $controller = str_replace('Controller', '', $reflection->getShortName());
         # - get the action based on the index[1]
         $action = $uses[1];
         $target = ['controller' => $controller, 'action' => $action];
         if ($namespace) {
             $target['namespace'] = $namespace;
         }
     }
     return ['target' => $target, 'name' => $route_name];
 }
コード例 #27
0
 /**
  * @param string $name
  * @param array  $parent
  * @param string $comment
  */
 public function __construct($name, $parent, $comment = '')
 {
     $reflection = new \ReflectionClass($parent);
     $this->parent = $reflection->getName();
     parent::__construct($name, $reflection->getShortName(), [], $comment);
     $this->declareStructure();
 }
コード例 #28
0
ファイル: base.php プロジェクト: luancuba/fakerpress
 public final function __construct()
 {
     $class_name = get_called_class();
     $reflection = new \ReflectionClass($class_name);
     $slug = strtolower($reflection->getShortName());
     if (isset(self::$_instances[$slug])) {
         // Don't create a new one
         return;
     }
     $this->slug = $slug;
     $this->faker = \Faker\Factory::create();
     self::$flag = apply_filters('fakerpress.modules_flag', self::$flag);
     $this->provider = (string) apply_filters("fakerpress.module.{$this->slug}.provider", $this->provider);
     $this->dependencies = (array) apply_filters("fakerpress.module.{$this->slug}.dependencies", $this->dependencies);
     // We need to merge the Provider to the Dependecies, so everything is loaded
     if (!empty($this->provider)) {
         $providers = array_merge($this->dependencies, (array) $this->provider);
     } else {
         $providers = $this->dependencies;
     }
     foreach ($providers as $provider_class) {
         $provider = new $provider_class($this->faker);
         $this->faker->addProvider($provider);
     }
     // Execute a method that can be overwritten by the called class
     $this->init();
     if ($this->page) {
         add_action('admin_menu', array($this, '_action_setup_admin_page'));
         add_action('fakerpress.view.request.' . $this->page->view, array(&$this, '_action_parse_request'));
     }
 }
コード例 #29
0
 public static function setUpBeforeClass()
 {
     $reflect = new \ReflectionClass(__CLASS__);
     self::$directory = @tempnam(sys_get_temp_dir(), $reflect->getShortName() . '-');
     @unlink(self::$directory);
     @mkdir(self::$directory);
 }
コード例 #30
0
 protected static function mockImpl($type_, array $args_ = [])
 {
     $type = new \ReflectionClass($type_);
     if ($type->isFinal()) {
         throw new Exception_IllegalArgument('mock/factory', 'Can not mock final class.');
     }
     $mtime = @filemtime($type->getFileName());
     $classMock = 'Mock_' . str_replace('\\', '_', $type->getNamespaceName()) . '_' . $type->getShortName() . "_{$mtime}";
     if (false === @class_exists($classMock)) {
         if (null === self::$m_tmpPath) {
             self::$m_tmpPath = (string) Test_Runner::get()->getTempPath();
         }
         $fileName = self::$m_tmpPath . "/{$classMock}.php";
         if (false === @file_exists($fileName)) {
             $source = self::weaveMock($classMock, new \ReflectionClass('Components\\Mock'), $type);
             if (false === @file_put_contents($fileName, $source, 0644)) {
                 throw new Exception_IllegalState('mock/factory', sprintf('Unable to create mock [type: %1$s, path: %2$s].', $type_, $fileName));
             }
         }
         require_once $fileName;
     }
     $classMock = "Components\\{$classMock}";
     if (0 < count($args_)) {
         $refl = new \ReflectionClass($classMock);
         $mock = $refl->newInstanceArgs($args_);
     } else {
         $mock = new $classMock();
     }
     $mock->mockType = $type;
     return $mock;
 }