Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
5 / 5 |
ArrayUtil | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
3 | |
100.00% |
5 / 5 |
getFromArray | |
100.00% |
1 / 1 |
3 | |
100.00% |
5 / 5 |
<?php | |
declare(strict_types = 1); | |
namespace Siesta\Util; | |
/** | |
* @author Gregor Müller | |
*/ | |
class ArrayUtil | |
{ | |
/** | |
* @param array $object | |
* @param string $key | |
* | |
* @return string|null | |
*/ | |
public static function getFromArray($object, $key = null) | |
{ | |
if ($object == null) { | |
return null; | |
} | |
if (!isset ($object [$key])) { | |
return null; | |
} | |
return $object [$key]; | |
} | |
} |