for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace ElfSundae\Laravel\Helper\Traits;
trait FluentArrayAccess
{
/**
* Get an attribute from the container.
*
* @param string $key
* @param mixed $default
* @return mixed
*/
abstract public function get($key, $default = null);
* Determine if the given offset exists.
* @param string $offset
* @return bool
public function offsetExists($offset)
return isset($this->attributes[$offset]);
attributes
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;
}
* Get the value for a given offset.
public function offsetGet($offset)
return $this->get($offset);
* Set the value at the given offset.
* @param mixed $value
* @return void
public function offsetSet($offset, $value)
$this->attributes[$offset] = $value;
* Unset the value at the given offset.
public function offsetUnset($offset)
unset($this->attributes[$offset]);
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: