-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
dp-ifacesoft
committed
Aug 4, 2020
1 parent
a15b130
commit c218ac3
Showing
3 changed files
with
65 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ | |
use Composer\Autoload\ClassLoader; | ||
use Ice\Core; | ||
use Ice\DataProvider\Repository; | ||
use Ice\Exception\Config_Error; | ||
use Ice\Exception\FileNotFound; | ||
use Ice\Helper\Class_Object; | ||
|
||
|
@@ -60,75 +61,21 @@ public static function autoload($class) | |
return null; | ||
} | ||
|
||
public static function isExistsClass($class) | ||
{ | ||
return class_exists($class, false) || interface_exists($class, false) || trait_exists($class, false); | ||
} | ||
|
||
/** | ||
* Load class | ||
* | ||
* @param $class | ||
* @return bool | ||
* @throws Exception | ||
* @author dp <[email protected]> | ||
* | ||
* @version 1.10 | ||
* @since 0.0 | ||
*/ | ||
public static function load($class) | ||
{ | ||
if (class_exists($class, false)) { | ||
return true; | ||
} | ||
|
||
if (Loader::$repository) { | ||
if ($fileName = Loader::$repository->get($class)) { | ||
include_once $fileName; | ||
return true; | ||
} | ||
} | ||
|
||
foreach (Loader::$autoloaders as $autoLoader) { | ||
$fileName = null; | ||
if ($autoLoader[0] instanceof ClassLoader) { | ||
if ($fileName = $autoLoader[0]->findFile($class)) { | ||
include_once $fileName; | ||
} | ||
} else { | ||
$fileName = call_user_func($autoLoader, $class); | ||
} | ||
|
||
if (is_string($fileName) && !empty($fileName) && Loader::isExistsClass($class)) { | ||
if (Loader::$repository) { | ||
Loader::$repository->set([$class => $fileName]); | ||
} | ||
|
||
return true; | ||
} | ||
} | ||
|
||
// todo: раскомментить | ||
// Logger::getInstance(__CLASS__)->warning(['Class {$0} not found', $class], __FILE__, __LINE__, null); | ||
|
||
return false; | ||
} | ||
|
||
/** | ||
* Return class path | ||
* | ||
* @param $class | ||
* @param $ext | ||
* @param $path | ||
* @param bool $isRequired | ||
* @param bool $isNotEmpty | ||
* @param bool $isOnlyFirst | ||
* @param bool $allMatchedPathes | ||
* @param bool $isRequired | ||
* @param bool $isNotEmpty | ||
* @param bool $isOnlyFirst | ||
* @param bool $allMatchedPathes | ||
* @return null|string | ||
* | ||
* @throws Exception | ||
* @throws FileNotFound | ||
* @throws \Ice\Exception\Config_Error | ||
* @throws Config_Error | ||
* @author dp <[email protected]> | ||
* | ||
* @version 0.0 | ||
|
@@ -200,6 +147,60 @@ public static function getFilePath( | |
return $isNotEmpty && !empty($fullStackPathes) ? reset($fullStackPathes) : ''; | ||
} | ||
|
||
public static function isExistsClass($class) | ||
{ | ||
return class_exists($class, false) || interface_exists($class, false) || trait_exists($class, false); | ||
} | ||
|
||
/** | ||
* Load class | ||
* | ||
* @param $class | ||
* @return bool | ||
* @author dp <[email protected]> | ||
* | ||
* @version 1.10 | ||
* @since 0.0 | ||
*/ | ||
public static function load($class) | ||
{ | ||
if (class_exists($class, false)) { | ||
return true; | ||
} | ||
|
||
if (Loader::$repository) { | ||
if ($fileName = Loader::$repository->get($class)) { | ||
include_once $fileName; | ||
return true; | ||
} | ||
} | ||
|
||
foreach (Loader::$autoloaders as $autoLoader) { | ||
$fileName = null; | ||
|
||
if (is_array($autoLoader) && $autoLoader[0] instanceof ClassLoader) { // old composer | ||
if ($fileName = $autoLoader[0]->findFile($class)) { | ||
include_once $fileName; | ||
} | ||
} else { | ||
$fileName = call_user_func($autoLoader, $class); | ||
} | ||
|
||
if (is_string($fileName) && !empty($fileName) && Loader::isExistsClass($class)) { | ||
if (Loader::$repository) { | ||
Loader::$repository->set([$class => $fileName]); | ||
} | ||
|
||
return true; | ||
} | ||
} | ||
|
||
// todo: раскомментить | ||
// Logger::getInstance(__CLASS__)->warning(['Class {$0} not found', $class], __FILE__, __LINE__, null); | ||
|
||
return false; | ||
} | ||
|
||
public static function init() | ||
{ | ||
self::$autoloaders = spl_autoload_functions(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -992,15 +992,14 @@ public function rlike($fieldName, $value, $modelTableData = [], $sqlLogical = Qu | |
* Set inner join query part | ||
* | ||
* @param $modelTableData | ||
* @param string|array $fieldNames | ||
* @param null $fieldNames | ||
* @param null $condition | ||
* @param bool $isUse | ||
* @return QueryBuilder | ||
* @throws Exception | ||
* @version 1.5 | ||
* @since 0.0 | ||
* @author dp <[email protected]> | ||
* | ||
*/ | ||
public function inner($modelTableData, $fieldNames = null, $condition = null, $isUse = true) | ||
{ | ||
|
@@ -2418,10 +2417,12 @@ public function getWidgets() | |
|
||
/** | ||
* @param $funcName | ||
* @param argumentString | ||
* @param $argumentString | ||
* @param array $modelTableData | ||
* @return $this | ||
* @throws Exception | ||
* | ||
* @todo feature using: ->func('fieldAlias', 'funcName', 'funcArgument', $modelTableData) | ||
*/ | ||
public function func($funcName, $argumentString, $modelTableData = []) | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters