Skip to content

Commit

Permalink
lc null
Browse files Browse the repository at this point in the history
  • Loading branch information
dakujem committed Sep 8, 2018
1 parent 2c34b1b commit eb7255c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions src/LazyIterator.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class LazyIterator implements OuterIterator
*
* @var Iterator
*/
private $iterator = NULL;
private $iterator = null;

/**
* An array of item mappers that act as a pipeline.
Expand All @@ -55,7 +55,7 @@ class LazyIterator implements OuterIterator
private $pipeline = [];


public function __construct(callable $provider, callable $mapper = NULL)
public function __construct(callable $provider, callable $mapper = null)
{
$this->provider = $provider;
$mapper !== NULL && $this->addMapper($mapper);
Expand All @@ -71,7 +71,7 @@ public function addMapper(callable $callable)

public function getInnerIterator(): Iterator
{
if ($this->iterator === NULL) {
if ($this->iterator === null) {
$res = call_user_func($this->provider);
if (is_array($res)) {
$this->iterator = new ArrayIterator($res);
Expand Down
14 changes: 7 additions & 7 deletions src/UrlConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@
*/
class UrlConfig
{
private $url = NULL;
private $url = null;
protected $mappings = [];
private $config = [];
private $int = [];


public function __construct($url = NULL)
public function __construct($url = null)
{
$this->url = $url;

Expand All @@ -46,8 +46,8 @@ public function __construct($url = NULL)
'username' => 'user',
'password' => 'pass',
'database' => function($config) {
$db = $config['path'] ?? NULL;
return $db === NULL ? NULL : ltrim($db, '/');
$db = $config['path'] ?? null;
return $db === null ? null : ltrim($db, '/');
},
];
}
Expand All @@ -58,7 +58,7 @@ protected function map(array $config, array $mappings): array
{
$res = [];
foreach ($mappings as $name => $mapping) {
$res[$name] = is_scalar($mapping) ? ($config[$mapping] ?? NULL) : call_user_func($mapping, $config, $name);
$res[$name] = is_scalar($mapping) ? ($config[$mapping] ?? null) : call_user_func($mapping, $config, $name);
}
return $res;
}
Expand All @@ -67,15 +67,15 @@ protected function map(array $config, array $mappings): array
public function getConfig()
{
$url = $this->getUrl();
if ($this->config === [] && $url !== NULL && $url !== '') {
if ($this->config === [] && $url !== null && $url !== '') {
$this->int = parse_url($url);
$this->config = $this->map($this->int, $this->mappings);
}
return $this->config;
}


public function get($what, $default = NULL)
public function get($what, $default = null)
{
return $this->getConfig()[$what] ?? $default;
}
Expand Down

0 comments on commit eb7255c

Please sign in to comment.