Skip to content

Instantly share code, notes, and snippets.

@ogabrielsantos
Last active August 29, 2015 14:22
Show Gist options
  • Save ogabrielsantos/ea422ee240629c7292a0 to your computer and use it in GitHub Desktop.
Save ogabrielsantos/ea422ee240629c7292a0 to your computer and use it in GitHub Desktop.
<?php
// PHP 5.4+
class GenericController
{
public $limit = 99999;
public final function paginate(
$object = null,
array $scope = [],
array $whitelist = []
) {
// Lot of codes
echo $this->limit . "\n";
}
}
class Foo extends GenericController
{
public $limit = 500;
}
class Bar extends GenericController
{
}
class Baz extends GenericController
{
}
(new Foo())->paginate(); // Outputs 500
(new Bar())->paginate(); // Outputs 99999
(new Baz())->paginate(); // Outputs 99999
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment