Skip to content

Commit

Permalink
Moved the createCallableObjects() method.
Browse files Browse the repository at this point in the history
  • Loading branch information
feuzeu committed Dec 3, 2019
1 parent abfce7e commit 7217b7e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
21 changes: 2 additions & 19 deletions src/Request/Plugin/CallableClass.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,31 +152,14 @@ public function register($sType, $sClassName, $aOptions)
return true;
}

/**
* Create callable objects for all registered namespaces
*
* @return void
*/
protected function createCallableObjects()
{
$this->xRegistry->parseDirectories();
$this->xRegistry->parseNamespaces();

// Create callable objects for registered directories
foreach($this->xRepository->getClasses() as $sClassName => $aClassOptions)
{
$this->xRepository->createCallableObject($sClassName, $aClassOptions);
}
}

/**
* Generate a hash for the registered callable objects
*
* @return string
*/
public function generateHash()
{
$this->createCallableObjects();
$this->xRegistry->createCallableObjects();
$aNamespaces = $this->xRepository->getNamespaces();
$aCallableObjects = $this->xRepository->getCallableObjects();
$sHash = '';
Expand Down Expand Up @@ -272,7 +255,7 @@ private function getCallableScript($sClassName, CallableObject $xCallableObject,
*/
public function getScript()
{
$this->createCallableObjects();
$this->xRegistry->createCallableObjects();

// The methods of the \Jaxon\CallableClass class must not be exported
$xCallableClass = new \ReflectionClass(UserCallableClass::class);
Expand Down
17 changes: 17 additions & 0 deletions src/Request/Support/CallableRegistry.php
Original file line number Diff line number Diff line change
Expand Up @@ -318,4 +318,21 @@ public function getCallableObject($sClassName)

return $this->xRepository->createCallableObject($sClassName, $aOptions);
}

/**
* Create callable objects for all registered namespaces
*
* @return void
*/
public function createCallableObjects()
{
$this->parseDirectories();
$this->parseNamespaces();

// Create callable objects for registered directories
foreach($this->xRepository->getClasses() as $sClassName => $aClassOptions)
{
$this->xRepository->createCallableObject($sClassName, $aClassOptions);
}
}
}

0 comments on commit 7217b7e

Please sign in to comment.