for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* Bluz Framework Component
*
* @copyright Bluz PHP Team
* @link https://github.com/bluzphp/framework
*/
declare(strict_types=1);
namespace Bluz\Common\Container;
* Container of data for object
* @package Bluz\Common
* @author Anton Shevchuk
* @link https://github.com/bluzphp/framework/wiki/Trait-Container
trait Container
{
* @var array Container of elements
protected $container = [];
* Set key/value pair
* @param string $key
* @param mixed $value
* @return void
protected function doSetContainer($key, $value)
$this->container[$key] = $value;
}
* Get value by key
* @return mixed
protected function doGetContainer($key)
if ($this->doContainsContainer($key)) {
return $this->container[$key];
} else {
return null;
* Check contains key in container
* @return bool
protected function doContainsContainer($key)
return array_key_exists($key, $this->container);
* Delete value by key
protected function doDeleteContainer($key)
unset($this->container[$key]);
* Sets all data in the row from an array
* @param array $data
* @return self
public function setFromArray(array $data)
foreach ($data as $key => $value) {
return $this;
* Returns the column/value data as an array
* @return array
public function toArray()
return $this->container;
* Reset container array
public function resetArray()
foreach ($this->container as &$value) {
$value = null;