datatable.directory codebase
https://datatable.directory/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
504 B
29 lines
504 B
<?php
|
|
|
|
namespace MightyPork\Utils;
|
|
|
|
use MightyPork\Exceptions\NotExistException;
|
|
use Illuminate\Support\Collection;
|
|
|
|
/**
|
|
* Improved collection with object access to fields
|
|
*/
|
|
class ObjCollection extends Collection
|
|
{
|
|
public function __get($name)
|
|
{
|
|
if (isset($this[$name])) return $this[$name];
|
|
|
|
throw new NotExistException("No '$name' in collection.");
|
|
}
|
|
|
|
public function __isset($name)
|
|
{
|
|
return isset($this[$name]);
|
|
}
|
|
|
|
public function __set($name, $value)
|
|
{
|
|
$this[$name] = $value;
|
|
}
|
|
}
|
|
|