for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace MocOrm\Support;
/**
* Model
*/
abstract class Model extends \MocOrm\Model\Model implements \ArrayAccess
{
* Gets model data.
*
* @return array
public function toArray()
return $this->getData();
}
* Gets model data through static method.
* @param mixed $data
public static function toList($data)
if (!($data instanceof self)) throw new \Exception(" It's not a model.");
$data = array_map(function ($object) { return $object->toArray(); }, $data);
$data
self
array
$arr1
array_map()
If this is a false-positive, you can also ignore this issue in your code via the ignore-type annotation
ignore-type
$data = array_map(function ($object) { return $object->toArray(); }, /** @scrutinizer ignore-type */ $data);
return $data;
* Get first model from query result.
* @return mixed
public function first()
return current($this->getData());
* ArrayAccess Interface.
public function offsetExists($offset)
$data = $this->getData();
return isset($data[$offset]);
public function offsetGet($offset)
return isset($data[$offset]) ? $data[$offset] : null;
public function offsetSet($offset, $value)
if (is_null($offset)) {
$data[] = $value;
} else {
$data[$offset] = $value;
public function offsetUnset($offset)
unset($this->data[$offset]);
data
MocOrm\Support\Model
__get