for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* PHP version 5.4 and 8
*
* @category Base
* @package Payever\Core
* @author payever GmbH <[email protected]>
* @copyright 2017-2021 payever GmbH
* @license MIT <https://opensource.org/licenses/MIT>
* @link https://docs.payever.org/shopsystems/api/getting-started
*/
namespace Payever\ExternalIntegration\Core\Base;
* Class represents Named List
class NamedList
{
/** @var array $list */
protected $list = [];
* Adds an item to the list
* @param string $name
* @param mixed $value
* @return $this
public function add($name, $value = null)
$this->list[$name] = $value;
return $this;
}
* Adds items to the list
* @param array $array
public function addAll(array $array)
$this->list = array_merge($this->list, $array);
* Clears the list
public function clear()
$this->list = [];
* Removes an item from the list
public function remove($name)
unset($this->list[$name]);
* Returns list size
* @return int
public function count()
return count($this->list);
* Returns an item with the name from the list
* @return array|bool|object
public function get($name)
if (isset($this->list[$name])) {
return $this->list[$name];
return false;
* Returns the list
* @return array
public function getAll()
return $this->list;
* Checks if the item exists
* @param object $value
* @return bool
public function contains($value)
if (in_array($value, array_values($this->list), true)) {
return true;