Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?php
class Model {
public static function find($name)
{
return 'Model::find::' . $name;
}
public function save()
{
return 'Model';
}
}
class Repository {
public static function __callStatic($name, $arguments)
{
return call_user_func_array([new Model, $name], $arguments);
}
public function __call($name, $arguments)
{
return call_user_func_array([new Model, $name], $arguments);
}
public function __set($name, $value)
{
$this->$name = $value;
}
public function __get($name)
{
return 'Erik';
}
}
echo Repository::save();
echo PHP_EOL;
echo (new Repository)->find('Thalisson');
$repo = new Repository;
$repo->name = 'Thalisson';
echo PHP_EOL;
echo $repo->melhorDevDaWebjump;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment