mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-11 09:48:40 +00:00
Use more global paths
This commit is contained in:
parent
d5e2d35672
commit
138b631a65
|
|
@ -1407,7 +1407,7 @@ class DataMapperAbstract implements DataMapperInterface
|
|||
{
|
||||
self::extend(__CLASS__);
|
||||
|
||||
if (is_scalar($obj)) {
|
||||
if (\is_scalar($obj)) {
|
||||
$obj = static::get($obj);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -73,13 +73,13 @@ final class Dispatcher
|
|||
{
|
||||
$views = [];
|
||||
|
||||
if (is_array($controller) && isset($controller['dest'])) {
|
||||
if (\is_array($controller) && isset($controller['dest'])) {
|
||||
$controller = $controller['dest'];
|
||||
}
|
||||
|
||||
if (is_string($controller)) {
|
||||
if (\is_string($controller)) {
|
||||
$views += $this->dispatchString($controller, $data);
|
||||
} elseif (is_array($controller)) {
|
||||
} elseif (\is_array($controller)) {
|
||||
$views += $this->dispatchArray($controller, $data);
|
||||
} elseif ($controller instanceof \Closure) {
|
||||
$views[] = $this->dispatchClosure($controller, $data);
|
||||
|
|
|
|||
|
|
@ -213,9 +213,9 @@ final class Money implements \Serializable
|
|||
*/
|
||||
public function add($value) : Money
|
||||
{
|
||||
if (is_string($value) || is_float($value)) {
|
||||
if (\is_string($value) || is_float($value)) {
|
||||
$this->value += self::toInt((string) $value, $this->thousands, $this->decimal);
|
||||
} elseif (is_int($value)) {
|
||||
} elseif (\is_int($value)) {
|
||||
$this->value += $value;
|
||||
} elseif ($value instanceof Money) {
|
||||
$this->value += $value->getInt();
|
||||
|
|
@ -247,9 +247,9 @@ final class Money implements \Serializable
|
|||
*/
|
||||
public function sub($value) : Money
|
||||
{
|
||||
if (is_string($value) || is_float($value)) {
|
||||
if (\is_string($value) || is_float($value)) {
|
||||
$this->value -= self::toInt((string) $value, $this->thousands, $this->decimal);
|
||||
} elseif (is_int($value)) {
|
||||
} elseif (\is_int($value)) {
|
||||
$this->value -= $value;
|
||||
} elseif ($value instanceof Money) {
|
||||
$this->value -= $value->getInt();
|
||||
|
|
@ -269,7 +269,7 @@ final class Money implements \Serializable
|
|||
*/
|
||||
public function mult($value) : Money
|
||||
{
|
||||
if (is_float($value) || is_int($value)) {
|
||||
if (\is_float($value) || is_int($value)) {
|
||||
$this->value = (int) ($this->value * $value);
|
||||
}
|
||||
|
||||
|
|
@ -287,7 +287,7 @@ final class Money implements \Serializable
|
|||
*/
|
||||
public function div($value) : Money
|
||||
{
|
||||
if (is_float($value) || is_int($value)) {
|
||||
if (\is_float($value) || is_int($value)) {
|
||||
$this->value = (int) ($this->value / $value);
|
||||
}
|
||||
|
||||
|
|
@ -319,7 +319,7 @@ final class Money implements \Serializable
|
|||
*/
|
||||
public function pow($value) : Money
|
||||
{
|
||||
if (is_float($value) || is_int($value)) {
|
||||
if (\is_float($value) || is_int($value)) {
|
||||
$this->value = (int) ($this->value ** $value);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -148,9 +148,9 @@ final class Complex
|
|||
|
||||
public function pow($value) : Complex
|
||||
{
|
||||
if (is_int($value)) {
|
||||
if (\is_int($value)) {
|
||||
return $this->powInteger($value);
|
||||
} elseif (is_numeric($value)) {
|
||||
} elseif (\is_numeric($value)) {
|
||||
return $this->powScalar($value);
|
||||
} elseif ($value instanceof Complex) {
|
||||
return $this->powComplex($value);
|
||||
|
|
@ -202,7 +202,7 @@ final class Complex
|
|||
*/
|
||||
public function add($value) : Complex
|
||||
{
|
||||
if (is_numeric($value)) {
|
||||
if (\is_numeric($value)) {
|
||||
return $this->addScalar($value);
|
||||
} elseif ($value instanceof Complex) {
|
||||
return $this->addComplex($value);
|
||||
|
|
@ -252,7 +252,7 @@ final class Complex
|
|||
*/
|
||||
public function sub($value) : Complex
|
||||
{
|
||||
if (is_numeric($value)) {
|
||||
if (\is_numeric($value)) {
|
||||
return $this->subScalar($value);
|
||||
} elseif ($value instanceof Complex) {
|
||||
return $this->subComplex($value);
|
||||
|
|
@ -302,7 +302,7 @@ final class Complex
|
|||
*/
|
||||
public function mult($value) : Complex
|
||||
{
|
||||
if (is_numeric($value)) {
|
||||
if (\is_numeric($value)) {
|
||||
return $this->multScalar($value);
|
||||
} elseif ($value instanceof Complex) {
|
||||
return $this->multComplex($value);
|
||||
|
|
@ -355,7 +355,7 @@ final class Complex
|
|||
*/
|
||||
public function div($value) : Complex
|
||||
{
|
||||
if (is_numeric($value)) {
|
||||
if (\is_numeric($value)) {
|
||||
return $this->divScalar($value);
|
||||
} elseif ($value instanceof Complex) {
|
||||
return $this->divComplex($value);
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ final class Basic
|
|||
}
|
||||
|
||||
foreach ($values as $value) {
|
||||
if (is_array($value)) {
|
||||
if (\is_array($value)) {
|
||||
$freaquency[] = self::frequency($value);
|
||||
} else {
|
||||
$freaquency[] = $value / $sum;
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ class ChiSquaredDistribution
|
|||
*/
|
||||
public static function getDegreesOfFreedom(array $values) : int
|
||||
{
|
||||
if (is_array($first = \reset($values))) {
|
||||
if (\is_array($first = \reset($values))) {
|
||||
return (\count($values) - 1) * (\count($first) - 1);
|
||||
} else {
|
||||
return \count($values) - 1;
|
||||
|
|
|
|||
|
|
@ -200,7 +200,7 @@ class MultiMap implements \Countable
|
|||
*/
|
||||
private function getMultiple($key)
|
||||
{
|
||||
if (is_array($key)) {
|
||||
if (\is_array($key)) {
|
||||
if ($this->orderType === OrderType::LOOSE) {
|
||||
$keys = Permutation::permut($key);
|
||||
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ class FtpStorage extends StorageAbstract
|
|||
*/
|
||||
public static function put(string $path, string $content, int $mode = 0) : bool
|
||||
{
|
||||
if (is_dir($path)) {
|
||||
if (\is_dir($path)) {
|
||||
throw new PathException($path);
|
||||
}
|
||||
|
||||
|
|
@ -68,7 +68,7 @@ class FtpStorage extends StorageAbstract
|
|||
*/
|
||||
public static function get(string $path) : string
|
||||
{
|
||||
if (is_dir($path)) {
|
||||
if (\is_dir($path)) {
|
||||
throw new PathException($path);
|
||||
}
|
||||
|
||||
|
|
@ -88,7 +88,7 @@ class FtpStorage extends StorageAbstract
|
|||
*/
|
||||
public static function list(string $path, string $filter = '*') : array
|
||||
{
|
||||
if (is_file($path)) {
|
||||
if (\is_file($path)) {
|
||||
throw new PathException($path);
|
||||
}
|
||||
|
||||
|
|
@ -100,7 +100,7 @@ class FtpStorage extends StorageAbstract
|
|||
*/
|
||||
public static function set(string $path, string $content) : bool
|
||||
{
|
||||
if (is_dir($path)) {
|
||||
if (\is_dir($path)) {
|
||||
throw new PathException($path);
|
||||
}
|
||||
|
||||
|
|
@ -112,7 +112,7 @@ class FtpStorage extends StorageAbstract
|
|||
*/
|
||||
public static function append(string $path, string $content) : bool
|
||||
{
|
||||
if (is_dir($path)) {
|
||||
if (\is_dir($path)) {
|
||||
throw new PathException($path);
|
||||
}
|
||||
|
||||
|
|
@ -124,7 +124,7 @@ class FtpStorage extends StorageAbstract
|
|||
*/
|
||||
public static function prepend(string $path, string $content) : bool
|
||||
{
|
||||
if (is_dir($path)) {
|
||||
if (\is_dir($path)) {
|
||||
throw new PathException($path);
|
||||
}
|
||||
|
||||
|
|
@ -136,7 +136,7 @@ class FtpStorage extends StorageAbstract
|
|||
*/
|
||||
public static function extension(string $path) : string
|
||||
{
|
||||
if (is_dir($path)) {
|
||||
if (\is_dir($path)) {
|
||||
throw new PathException($path);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ final class Storage
|
|||
public static function env(string $env = 'local') : StorageAbstract
|
||||
{
|
||||
if (isset(self::$registered[$env])) {
|
||||
if (is_string(self::$registered[$env])) {
|
||||
if (\is_string(self::$registered[$env])) {
|
||||
$env = self::$registered[$env]::getInstance();
|
||||
} elseif (self::$registered[$env] instanceof StorageAbstract || self::$registered[$env] instanceof ContainerInterface) {
|
||||
$env = self::$registered[$env];
|
||||
|
|
|
|||
|
|
@ -102,11 +102,11 @@ final class ArrayUtils
|
|||
|
||||
if ($overwrite) {
|
||||
$current = $value;
|
||||
} elseif (is_array($current) && !is_array($value)) {
|
||||
} elseif (\is_array($current) && !is_array($value)) {
|
||||
$current[] = $value;
|
||||
} elseif (is_array($current) && is_array($value)) {
|
||||
} elseif (\is_array($current) && is_array($value)) {
|
||||
$current = array_merge($current, $value);
|
||||
} elseif (is_scalar($current) && $current !== null) {
|
||||
} elseif (\is_scalar($current) && $current !== null) {
|
||||
$current = [$current, $value];
|
||||
} else {
|
||||
$current = $value;
|
||||
|
|
@ -163,7 +163,7 @@ final class ArrayUtils
|
|||
foreach ($haystack as $item) {
|
||||
if ($item === $needle) {
|
||||
return true;
|
||||
} elseif (is_array($item)) {
|
||||
} elseif (\is_array($item)) {
|
||||
$found = self::inArrayRecursive($needle, $item);
|
||||
|
||||
if ($found) {
|
||||
|
|
@ -233,7 +233,7 @@ final class ArrayUtils
|
|||
$str = '[';
|
||||
|
||||
foreach ($array as $key => $value) {
|
||||
if (is_string($key)) {
|
||||
if (\is_string($key)) {
|
||||
$key = '\'' . $key . '\'';
|
||||
}
|
||||
|
||||
|
|
@ -352,7 +352,7 @@ final class ArrayUtils
|
|||
while (!empty($stack)) {
|
||||
$value = array_shift($stack);
|
||||
|
||||
if (is_array($value)) {
|
||||
if (\is_array($value)) {
|
||||
$stack = array_merge(array_values($value), $stack);
|
||||
} else {
|
||||
$flat[] = $value;
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ final class Dictionary
|
|||
sort($count);
|
||||
}
|
||||
|
||||
$this->fill(is_array($count[0][1]) ? $count[0][1] : $count);
|
||||
$this->fill(\is_array($count[0][1]) ? $count[0][1] : $count);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ class ArrayParser
|
|||
$stringify = '[' . "\n";
|
||||
|
||||
foreach ($arr as $key => $val) {
|
||||
if (is_string($key)) {
|
||||
if (\is_string($key)) {
|
||||
$key = '\'' . \str_replace('\'', '\\\'', $key) . '\'';
|
||||
}
|
||||
|
||||
|
|
@ -63,15 +63,15 @@ class ArrayParser
|
|||
*/
|
||||
public static function parseVariable($value, int $depth = 1) : string
|
||||
{
|
||||
if (is_array($value)) {
|
||||
if (\is_array($value)) {
|
||||
return ArrayParser::serializeArray($value, $depth);
|
||||
} elseif (is_string($value)) {
|
||||
} elseif (\is_string($value)) {
|
||||
return '\'' . \str_replace('\'', '\\\'', $value) . '\'';
|
||||
} elseif (is_scalar($value)) {
|
||||
} elseif (\is_scalar($value)) {
|
||||
return (string) $value;
|
||||
} elseif ($value === null) {
|
||||
return 'null';
|
||||
} elseif (is_bool($value)) {
|
||||
} elseif (\is_bool($value)) {
|
||||
return $value ? 'true' : 'false';
|
||||
} elseif ($value instanceOf \Serializable) {
|
||||
return self::parseVariable($value->serialize());
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ final class StringUtils
|
|||
*/
|
||||
public static function endsWith(string $haystack, $needles) : bool
|
||||
{
|
||||
if (is_string($needles)) {
|
||||
if (\is_string($needles)) {
|
||||
$needles = [$needles];
|
||||
}
|
||||
|
||||
|
|
@ -140,7 +140,7 @@ final class StringUtils
|
|||
*/
|
||||
public static function startsWith(string $haystack, $needles) : bool
|
||||
{
|
||||
if (is_string($needles)) {
|
||||
if (\is_string($needles)) {
|
||||
$needles = [$needles];
|
||||
}
|
||||
|
||||
|
|
@ -168,7 +168,7 @@ final class StringUtils
|
|||
*/
|
||||
public static function mb_startsWith(string $haystack, $needles) : bool
|
||||
{
|
||||
if (is_string($needles)) {
|
||||
if (\is_string($needles)) {
|
||||
$needles = [$needles];
|
||||
}
|
||||
|
||||
|
|
@ -200,7 +200,7 @@ final class StringUtils
|
|||
*/
|
||||
public static function mb_endsWith(string $haystack, $needles) : bool
|
||||
{
|
||||
if (is_string($needles)) {
|
||||
if (\is_string($needles)) {
|
||||
$needles = [$needles];
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -255,7 +255,7 @@ abstract class ViewAbstract implements \Serializable
|
|||
$includeData = include $path;
|
||||
$ob = (string) ob_get_clean();
|
||||
|
||||
if (is_array($includeData)) {
|
||||
if (\is_array($includeData)) {
|
||||
return (string) \json_encode($includeData);
|
||||
}
|
||||
} catch (\Throwable $e) {
|
||||
|
|
|
|||
|
|
@ -62,32 +62,32 @@ class AccountTest extends \PHPUnit\Framework\TestCase
|
|||
$account = new Account();
|
||||
|
||||
/* Testing default values */
|
||||
self::assertTrue(is_int($account->getId()));
|
||||
self::assertTrue(\is_int($account->getId()));
|
||||
self::assertEquals(0, $account->getId());
|
||||
|
||||
self::assertInstanceOf('\phpOMS\Localization\Localization', $account->getL11n());
|
||||
|
||||
self::assertEquals([], $account->getGroups());
|
||||
|
||||
self::assertTrue(is_string($account->getName()));
|
||||
self::assertTrue(\is_string($account->getName()));
|
||||
self::assertEquals('', $account->getName());
|
||||
|
||||
self::assertTrue(is_string($account->getName1()));
|
||||
self::assertTrue(\is_string($account->getName1()));
|
||||
self::assertEquals('', $account->getName1());
|
||||
|
||||
self::assertTrue(is_string($account->getName2()));
|
||||
self::assertTrue(\is_string($account->getName2()));
|
||||
self::assertEquals('', $account->getName2());
|
||||
|
||||
self::assertTrue(is_string($account->getName3()));
|
||||
self::assertTrue(\is_string($account->getName3()));
|
||||
self::assertEquals('', $account->getName3());
|
||||
|
||||
self::assertTrue(is_string($account->getEmail()));
|
||||
self::assertTrue(\is_string($account->getEmail()));
|
||||
self::assertEquals('', $account->getEmail());
|
||||
|
||||
self::assertTrue(is_int($account->getStatus()));
|
||||
self::assertTrue(\is_int($account->getStatus()));
|
||||
self::assertEquals(AccountStatus::INACTIVE, $account->getStatus());
|
||||
|
||||
self::assertTrue(is_int($account->getType()));
|
||||
self::assertTrue(\is_int($account->getType()));
|
||||
self::assertEquals(AccountType::USER, $account->getType());
|
||||
|
||||
self::assertEquals([], $account->getPermissions());
|
||||
|
|
@ -96,7 +96,7 @@ class AccountTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertInstanceOf('\DateTime', $account->getCreatedAt());
|
||||
|
||||
$array = $account->toArray();
|
||||
self::assertTrue(is_array($array));
|
||||
self::assertTrue(\is_array($array));
|
||||
self::assertGreaterThan(0, \count($array));
|
||||
self::assertEquals(\json_encode($array), $account->__toString());
|
||||
self::assertEquals($array, $account->jsonSerialize());
|
||||
|
|
|
|||
|
|
@ -40,20 +40,20 @@ class GroupTest extends \PHPUnit\Framework\TestCase
|
|||
$group = new Group();
|
||||
|
||||
/* Testing default values */
|
||||
self::assertTrue(is_int($group->getId()));
|
||||
self::assertTrue(\is_int($group->getId()));
|
||||
self::assertEquals(0, $group->getId());
|
||||
|
||||
self::assertTrue(is_string($group->getName()));
|
||||
self::assertTrue(\is_string($group->getName()));
|
||||
self::assertEquals('', $group->getName());
|
||||
|
||||
self::assertTrue(is_int($group->getStatus()));
|
||||
self::assertTrue(\is_int($group->getStatus()));
|
||||
self::assertEquals(GroupStatus::INACTIVE, $group->getStatus());
|
||||
|
||||
self::assertTrue(is_string($group->getDescription()));
|
||||
self::assertTrue(\is_string($group->getDescription()));
|
||||
self::assertEquals('', $group->getDescription());
|
||||
|
||||
$array = $group->toArray();
|
||||
self::assertTrue(is_array($array));
|
||||
self::assertTrue(\is_array($array));
|
||||
self::assertGreaterThan(0, \count($array));
|
||||
self::assertEquals(\json_encode($array), $group->__toString());
|
||||
self::assertEquals($array, $group->jsonSerialize());
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ class FileCacheTest extends \PHPUnit\Framework\TestCase
|
|||
|
||||
$cache = new FileCache(__DIR__ . '/Cache');
|
||||
|
||||
self::assertTrue(is_dir(__DIR__ . '/Cache'));
|
||||
self::assertTrue(\is_dir(__DIR__ . '/Cache'));
|
||||
self::assertTrue($cache->flushAll());
|
||||
self::assertEquals(50, $cache->getThreshold());
|
||||
self::assertEquals(null, $cache->get('test'));
|
||||
|
|
|
|||
|
|
@ -155,8 +155,8 @@ class MultiMapTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals(3, \count($map->keys()));
|
||||
self::assertEquals(2, \count($map->values()));
|
||||
|
||||
self::assertTrue(is_array($map->keys()));
|
||||
self::assertTrue(is_array($map->values()));
|
||||
self::assertTrue(\is_array($map->keys()));
|
||||
self::assertTrue(\is_array($map->values()));
|
||||
}
|
||||
|
||||
public function testSiblings()
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ class ViewTest extends \PHPUnit\Framework\TestCase
|
|||
|
||||
self::assertEmpty($view->getTemplate());
|
||||
self::assertEmpty($view->getViews());
|
||||
self::assertTrue(is_array($view->getViews()));
|
||||
self::assertTrue(\is_array($view->getViews()));
|
||||
self::assertFalse($view->getView(0));
|
||||
self::assertFalse($view->removeView(0));
|
||||
self::assertNull($view->getData(0));
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user