for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Bouhnosaure\Dogecoin;
trait SerializableContainerTrait
{
/**
* Gets container.
*
* @return array
*/
public function getContainer()
return $this->container;
container
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
class MyClass { } $x = new MyClass(); $x->foo = true;
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:
class MyClass { public $foo; } $x = new MyClass(); $x->foo = true;
}
* Returns the string representation of the object.
* @return string
public function serialize()
return serialize($this->container);
* Constructs object from serialized string.
* @param string $serialized
* @return void
public function unserialize($serialized)
$this->container = unserialize($serialized);
* Serializes the object to a value that can be serialized by json_encode().
public function jsonSerialize()
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: