Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
dp-ifacesoft committed Aug 4, 2020
1 parent a15b130 commit c218ac3
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 63 deletions.
119 changes: 60 additions & 59 deletions source/Ice/Core/Loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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();
Expand Down
7 changes: 4 additions & 3 deletions source/Ice/Core/QueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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 = [])
{
Expand Down
2 changes: 1 addition & 1 deletion source/Ice/QueryTranslator/Sql.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class Sql extends QueryTranslator
const SQL_STATEMENT_UPDATE = 'UPDATE';
const SQL_STATEMENT_DELETE = 'DELETE';
const SQL_CLAUSE_FROM = 'FROM';
const SQL_CLAUSE_UNION = 'UNION';
const SQL_CLAUSE_UNION = 'UNION ALL';
const SQL_CLAUSE_INTO = 'INTO';
const SQL_CLAUSE_SET = 'SET';
const SQL_CLAUSE_VALUES = 'VALUES';
Expand Down

0 comments on commit c218ac3

Please sign in to comment.