Exemplo n.º 1
0
 /**
  * To store a single instance of each state instance, shared by all stated class instance.
  *
  * @param string          $loadingStateName
  * @param FinderInterface $finderLoader
  * @param bool            $enablePrivateMode
  *
  * @return \Teknoo\States\State\StateInterface
  */
 private function buildState(string $loadingStateName, FinderInterface $finderLoader, bool $enablePrivateMode)
 {
     if (!isset($this->statesInstancesList[$loadingStateName])) {
         $this->statesInstancesList[$loadingStateName] = $finderLoader->buildState($loadingStateName, $enablePrivateMode, $finderLoader->getStatedClassName(), $this->computeStateAlias($loadingStateName, $finderLoader));
     }
     return $this->statesInstancesList[$loadingStateName];
 }
Exemplo n.º 2
0
 /**
  * Return the Factory Object Interface.
  *
  * @param FinderInterface $finder
  *
  * @return Factory\FactoryInterface
  */
 public function getFactoryObject(FinderInterface $finder)
 {
     $factory = new Factory\Integrated($finder->getStatedClassName(), $finder, $this->repository);
     return $factory;
 }
Exemplo n.º 3
0
 /**
  * Test if the finder is able to return the stated class name where it's user.
  */
 public function testGetStatedClassName()
 {
     $this->initializeFinder('It\\A\\Stated\\Class', $this->statedClass5Path);
     $this->assertEquals('It\\A\\Stated\\Class', $this->finder->getStatedClassName());
 }