Skip to content

Commit

Permalink
Fix conflicts between traits
Browse files Browse the repository at this point in the history
  • Loading branch information
RomainPct committed Jun 6, 2020
1 parent b1006d5 commit 8610651
Show file tree
Hide file tree
Showing 12 changed files with 46 additions and 26 deletions.
Expand Up @@ -17,7 +17,9 @@
*/
class AdminTextsManager {

use JsonReader;
use JsonReader {
JsonReader::readJsonFile as atm_readJsonFile;
}

private $_languagesPath = ROOT_DIR."/admin/config/languages/", $_texts = [];

Expand All @@ -37,7 +39,7 @@ public function __construct(String $moduleName){
file_put_contents($this->_languagesPath.$code.".json",$tradsData);
}
}
$tmp_texts = $this->readJsonFile($this->_languagesPath.$code.".json");
$tmp_texts = $this->atm_readJsonFile($this->_languagesPath.$code.".json");
$this->_texts = (key_exists($moduleName,$tmp_texts)) ? $tmp_texts[$moduleName] : [] ;
}

Expand Down
Expand Up @@ -10,7 +10,9 @@

class CandideAdminPlatformUpdater {

use JsonReader;
use JsonReader {
JsonReader::readJsonFile as capu_readJsonFile;
}

private $_indexAdmin;
private $_phpFiles = [];
Expand Down Expand Up @@ -63,7 +65,7 @@ public function update() {
*/
private function recordCollectionConfigFile(String $collectionConfigFilePath) {
$collectionName = $this->getInstanceNameFromFilePath($collectionConfigFilePath);
$config = $this->readJsonFile($collectionConfigFilePath);
$config = $this->capu_readJsonFile($collectionConfigFilePath);
if (key_exists('instances', $config)) {
foreach ($config['instances'] as $instanceName) {
$this->recordCollectionConfig($instanceName, $config);
Expand Down Expand Up @@ -107,7 +109,7 @@ private function recordCollectionConfig(String $name, Array $config) {
*/
private function recordPageConfigFile(String $pageConfigFilePath) {
$c = new CandidePage($this->getInstanceNameFromFilePath($pageConfigFilePath));
foreach ($this->readJsonFile($pageConfigFilePath) as $title => $field) {
foreach ($this->capu_readJsonFile($pageConfigFilePath) as $title => $field) {
$c->setElementFromConfigFile($title, $field);
}
$this->recordCandideInstance($c);
Expand Down
Expand Up @@ -16,7 +16,7 @@
*/
trait FieldsGenerator {

use BackendPluginNotifier, FilesManager;
use BackendPluginNotifier;

protected $_texts = null, $_extensionsUsed = [];

Expand Down
8 changes: 5 additions & 3 deletions Demo/admin/php/general/class/CandideIndexBasic.class.php
Expand Up @@ -17,7 +17,9 @@
*/
class CandideIndexBasic extends Basic {

use JsonReader;
use JsonReader {
JsonReader::readJsonFile as cib_readJsonFile;
}

protected $_pages;
protected $_collections;
Expand All @@ -30,8 +32,8 @@ class CandideIndexBasic extends Basic {
* Set $_pages & $_collections from json indexes files
*/
public function __construct() {
$this->_pages = $this->readJsonFile(self::PAGES_INDEX_URL);
$this->_collections = $this->readJsonFile(self::COLLECTION_INDEX_URL);
$this->_pages = $this->cib_readJsonFile(self::PAGES_INDEX_URL);
$this->_collections = $this->cib_readJsonFile(self::COLLECTION_INDEX_URL);
}

}
6 changes: 4 additions & 2 deletions Demo/admin/php/general/trait/BackendPluginNotifier.trait.php
Expand Up @@ -16,7 +16,9 @@
*/
trait BackendPluginNotifier {

use JsonReader;
use JsonReader {
JsonReader::readJsonFile as bpn_readJsonFile;
}

protected $_backendPlugins = null;

Expand All @@ -28,7 +30,7 @@ trait BackendPluginNotifier {
private function setBackendPlugins(){
$this->_backendPlugins = [];
foreach (glob(self::PLUGINS_DIRECTORY."*", GLOB_ONLYDIR) as $pluginFolder) {
$plugin = $this->readJsonFile($pluginFolder."/config.json");
$plugin = $this->bpn_readJsonFile($pluginFolder."/config.json");
if ($plugin["is_backend_extension"]) {
$this->_backendPlugins[] = $pluginFolder."/eventHandler.php";
}
Expand Down
6 changes: 4 additions & 2 deletions Demo/admin/php/plugins/class/PluginHelper.class.php
Expand Up @@ -17,7 +17,9 @@
*/
class PluginHelper {

use JsonReader;
use JsonReader {
JsonReader::readJsonFile as ph_readJsonFile;
}

private $_config, $_pluginName;

Expand All @@ -28,7 +30,7 @@ class PluginHelper {
*/
public function __construct(String $pluginName) {
$this->_pluginName = $pluginName;
$this->_config = $this->readJsonFile(ROOT_DIR."/admin/plugins/".$pluginName."/config.json");
$this->_config = $this->ph_readJsonFile(ROOT_DIR."/admin/plugins/".$pluginName."/config.json");
}

/**
Expand Down
Expand Up @@ -17,7 +17,9 @@
*/
class AdminTextsManager {

use JsonReader;
use JsonReader {
JsonReader::readJsonFile as atm_readJsonFile;
}

private $_languagesPath = ROOT_DIR."/admin/config/languages/", $_texts = [];

Expand All @@ -37,7 +39,7 @@ public function __construct(String $moduleName){
file_put_contents($this->_languagesPath.$code.".json",$tradsData);
}
}
$tmp_texts = $this->readJsonFile($this->_languagesPath.$code.".json");
$tmp_texts = $this->atm_readJsonFile($this->_languagesPath.$code.".json");
$this->_texts = (key_exists($moduleName,$tmp_texts)) ? $tmp_texts[$moduleName] : [] ;
}

Expand Down
Expand Up @@ -10,7 +10,9 @@

class CandideAdminPlatformUpdater {

use JsonReader;
use JsonReader {
JsonReader::readJsonFile as capu_readJsonFile;
}

private $_indexAdmin;
private $_phpFiles = [];
Expand Down Expand Up @@ -63,7 +65,7 @@ public function update() {
*/
private function recordCollectionConfigFile(String $collectionConfigFilePath) {
$collectionName = $this->getInstanceNameFromFilePath($collectionConfigFilePath);
$config = $this->readJsonFile($collectionConfigFilePath);
$config = $this->capu_readJsonFile($collectionConfigFilePath);
if (key_exists('instances', $config)) {
foreach ($config['instances'] as $instanceName) {
$this->recordCollectionConfig($instanceName, $config);
Expand Down Expand Up @@ -107,7 +109,7 @@ private function recordCollectionConfig(String $name, Array $config) {
*/
private function recordPageConfigFile(String $pageConfigFilePath) {
$c = new CandidePage($this->getInstanceNameFromFilePath($pageConfigFilePath));
foreach ($this->readJsonFile($pageConfigFilePath) as $title => $field) {
foreach ($this->capu_readJsonFile($pageConfigFilePath) as $title => $field) {
$c->setElementFromConfigFile($title, $field);
}
$this->recordCandideInstance($c);
Expand Down
Expand Up @@ -16,7 +16,7 @@
*/
trait FieldsGenerator {

use BackendPluginNotifier, FilesManager;
use BackendPluginNotifier;

protected $_texts = null, $_extensionsUsed = [];

Expand Down
8 changes: 5 additions & 3 deletions Source/admin/php/general/class/CandideIndexBasic.class.php
Expand Up @@ -17,7 +17,9 @@
*/
class CandideIndexBasic extends Basic {

use JsonReader;
use JsonReader {
JsonReader::readJsonFile as cib_readJsonFile;
}

protected $_pages;
protected $_collections;
Expand All @@ -30,8 +32,8 @@ class CandideIndexBasic extends Basic {
* Set $_pages & $_collections from json indexes files
*/
public function __construct() {
$this->_pages = $this->readJsonFile(self::PAGES_INDEX_URL);
$this->_collections = $this->readJsonFile(self::COLLECTION_INDEX_URL);
$this->_pages = $this->cib_readJsonFile(self::PAGES_INDEX_URL);
$this->_collections = $this->cib_readJsonFile(self::COLLECTION_INDEX_URL);
}

}
Expand Up @@ -16,7 +16,9 @@
*/
trait BackendPluginNotifier {

use JsonReader;
use JsonReader {
JsonReader::readJsonFile as bpn_readJsonFile;
}

protected $_backendPlugins = null;

Expand All @@ -28,7 +30,7 @@ trait BackendPluginNotifier {
private function setBackendPlugins(){
$this->_backendPlugins = [];
foreach (glob(self::PLUGINS_DIRECTORY."*", GLOB_ONLYDIR) as $pluginFolder) {
$plugin = $this->readJsonFile($pluginFolder."/config.json");
$plugin = $this->bpn_readJsonFile($pluginFolder."/config.json");
if ($plugin["is_backend_extension"]) {
$this->_backendPlugins[] = $pluginFolder."/eventHandler.php";
}
Expand Down
6 changes: 4 additions & 2 deletions Source/admin/php/plugins/class/PluginHelper.class.php
Expand Up @@ -17,7 +17,9 @@
*/
class PluginHelper {

use JsonReader;
use JsonReader {
JsonReader::readJsonFile as ph_readJsonFile;
}

private $_config, $_pluginName;

Expand All @@ -28,7 +30,7 @@ class PluginHelper {
*/
public function __construct(String $pluginName) {
$this->_pluginName = $pluginName;
$this->_config = $this->readJsonFile(ROOT_DIR."/admin/plugins/".$pluginName."/config.json");
$this->_config = $this->ph_readJsonFile(ROOT_DIR."/admin/plugins/".$pluginName."/config.json");
}

/**
Expand Down

0 comments on commit 8610651

Please sign in to comment.