Change use array to object

This commit is contained in:
Marco Antonio Nina Mena
2017-10-19 10:04:15 -04:00
parent babfb1a22e
commit 5fe388fc90
3 changed files with 297 additions and 291 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1245,15 +1245,18 @@ class PluginRegistry
*/
public function registerExtendsRestService($Namespace, $ClassName)
{
$baseSrcPluginPath = PATH_PLUGINS . $Namespace . PATH_SEP . "src";
$apiPath = PATH_SEP . "Services" . PATH_SEP . "Ext" . PATH_SEP;
$baseSrcPluginPath = PATH_PLUGINS . $Namespace . PATH_SEP . 'src';
$apiPath = PATH_SEP . 'Services' . PATH_SEP . 'Ext' . PATH_SEP;
$classFile = $baseSrcPluginPath . $apiPath . 'Ext' . $ClassName . '.php';
if (file_exists($classFile)) {
$this->_restExtendServices[$Namespace][$ClassName] = array(
"filePath" => $classFile,
"classParent" => $ClassName,
"classExtend" => 'Ext' . $ClassName
);
if (\file_exists($classFile)) {
if (empty($this->_restExtendServices[$Namespace])) {
$this->_restExtendServices[$Namespace] = new \stdClass();
}
$this->_restExtendServices[$Namespace]->{$ClassName} = [
'filePath' => $classFile,
'classParent' => $ClassName,
'classExtend' => 'Ext' . $ClassName
];
}
}
@@ -1264,10 +1267,10 @@ class PluginRegistry
*/
public function getExtendsRestService($ClassName)
{
$responseRestExtendService = array();
$responseRestExtendService = [];
foreach ($this->_restExtendServices as $Namespace => $restExtendService) {
if (isset($restExtendService[$ClassName])) {
$responseRestExtendService = $restExtendService[$ClassName];
if (isset($restExtendService->{$ClassName})) {
$responseRestExtendService = $restExtendService->{$ClassName};
break;
}
}
@@ -1282,10 +1285,10 @@ class PluginRegistry
*/
public function disableExtendsRestService($Namespace, $ClassName = '')
{
if (isset($this->_restExtendServices[$Namespace][$ClassName]) && !empty($ClassName)) {
unset($this->_restExtendServices[$Namespace][$ClassName]);
} elseif (empty($ClassName)) {
if (empty($ClassName)) {
unset($this->_restExtendServices[$Namespace]);
} elseif (isset($this->_restExtendServices[$Namespace]->{$ClassName})) {
unset($this->_restExtendServices[$Namespace]->{$ClassName});
}
}

View File

@@ -116,7 +116,7 @@ trait PluginStructure
$this->buildCss(G::json_decode($plugin['PluginCss'], true));
$this->buildJs(G::json_decode($plugin['PluginJs'], true));
$this->buildRestService(G::json_decode($plugin['PluginRestService'], true));
$this->buildAttributes($plugin['PluginNamespace'], G::json_decode($plugin['PluginAttributes'], true));
$this->buildAttributes($plugin['PluginNamespace'], G::json_decode($plugin['PluginAttributes']));
}
}
}