Skip to content

Commit

Permalink
Fix up late static binding for a consistent internal class usage.
Browse files Browse the repository at this point in the history
  • Loading branch information
dereuromark committed Dec 2, 2017
1 parent 5a5d2b7 commit d01efaa
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/Database/Type.php
Expand Up @@ -121,7 +121,7 @@ public static function build($name)
public static function buildAll()
{
$result = [];
foreach (self::$_types as $name => $type) {
foreach (static::$_types as $name => $type) {
$result[$name] = isset(static::$_builtTypes[$name]) ? static::$_builtTypes[$name] : static::build($name);
}

Expand Down Expand Up @@ -153,19 +153,19 @@ public static function set($name, Type $instance)
public static function map($type = null, $className = null)
{
if ($type === null) {
return self::$_types;
return static::$_types;
}
if (is_array($type)) {
self::$_types = $type;
static::$_types = $type;

return null;
}
if ($className === null) {
return isset(self::$_types[$type]) ? self::$_types[$type] : null;
return isset(static::$_types[$type]) ? static::$_types[$type] : null;
}

self::$_types[$type] = $className;
unset(self::$_builtTypes[$type]);
static::$_types[$type] = $className;
unset(static::$_builtTypes[$type]);
}

/**
Expand All @@ -175,8 +175,8 @@ public static function map($type = null, $className = null)
*/
public static function clear()
{
self::$_types = [];
self::$_builtTypes = [];
static::$_types = [];
static::$_builtTypes = [];
}

/**
Expand Down Expand Up @@ -228,8 +228,8 @@ protected function _basicTypeCast($value)
if ($value === null) {
return null;
}
if (!empty(self::$_basicTypes[$this->_name])) {
$typeInfo = self::$_basicTypes[$this->_name];
if (!empty(static::$_basicTypes[$this->_name])) {
$typeInfo = static::$_basicTypes[$this->_name];
if (isset($typeInfo['callback'])) {
return $typeInfo['callback']($value);
}
Expand Down

0 comments on commit d01efaa

Please sign in to comment.