import axiom without dependency on symfony console
Some checks failed
abc-api/abcParser/pipeline/head There was a failure building this commit
Some checks failed
abc-api/abcParser/pipeline/head There was a failure building this commit
This commit is contained in:
33
axiom_src/Bags/ArrayBag.php
Normal file
33
axiom_src/Bags/ArrayBag.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace Enzyme\Axiom\Bags;
|
||||
|
||||
class ArrayBag implements BagInterface
|
||||
{
|
||||
protected $store;
|
||||
|
||||
public function __construct(array $store)
|
||||
{
|
||||
$this->store = $store;
|
||||
}
|
||||
|
||||
public function get($key)
|
||||
{
|
||||
if ($this->has($key)) {
|
||||
return $this->store[$key];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public function has($key)
|
||||
{
|
||||
return isset($this->store[$key])
|
||||
&& array_key_exists($key, $this->store);
|
||||
}
|
||||
|
||||
public function getAll()
|
||||
{
|
||||
return $this->store;
|
||||
}
|
||||
}
|
||||
32
axiom_src/Bags/BagInterface.php
Normal file
32
axiom_src/Bags/BagInterface.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace Enzyme\Axiom\Bags;
|
||||
|
||||
interface BagInterface
|
||||
{
|
||||
/**
|
||||
* Get the value associated with the given key. If the key does not
|
||||
* exist, return null instead.
|
||||
*
|
||||
* @param string $key
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function get($key);
|
||||
|
||||
/**
|
||||
* Get all the key/value pairs for this bag.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getAll();
|
||||
|
||||
/**
|
||||
* Check whether there is a value associated with the given key.
|
||||
*
|
||||
* @param string $key
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function has($key);
|
||||
}
|
||||
Reference in New Issue
Block a user