This commit is contained in:
Roly Rudy Gutierrez Pinto
2017-10-23 15:55:58 -04:00
parent e7ca3e6887
commit 78cd531b62

View File

@@ -171,6 +171,14 @@ class Restler extends \Luracast\Restler\Restler
$this->responseData = $result; $this->responseData = $result;
} }
/**
* Review the API extensions, if the extension exists a new instance is
* returned.
*
* @param objecy $object
* @param string $className
* @return \Maveriks\Extension\classExtName
*/
public function reviewApiExtensions($object, $className) public function reviewApiExtensions($object, $className)
{ {
$classReflection = new \ReflectionClass($object); $classReflection = new \ReflectionClass($object);
@@ -178,10 +186,10 @@ class Restler extends \Luracast\Restler\Restler
$registry = PluginRegistry::loadSingleton(); $registry = PluginRegistry::loadSingleton();
$pluginsApiExtend = $registry->getExtendsRestService($classShortName); $pluginsApiExtend = $registry->getExtendsRestService($classShortName);
if ($pluginsApiExtend) { if ($pluginsApiExtend) {
$classFilePath = $pluginsApiExtend['filePath']; $classFilePath = $pluginsApiExtend->filePath;
if (file_exists($classFilePath)) { if (file_exists($classFilePath)) {
require_once($classFilePath); require_once($classFilePath);
$classExtName = $pluginsApiExtend['classExtend']; $classExtName = $pluginsApiExtend->classExtend;
$newObjectExt = new $classExtName(); $newObjectExt = new $classExtName();
if (is_subclass_of($newObjectExt, $className)) { if (is_subclass_of($newObjectExt, $className)) {
$object = $newObjectExt; $object = $newObjectExt;
@@ -190,5 +198,4 @@ class Restler extends \Luracast\Restler\Restler
} }
return $object; return $object;
} }
} }