Skip to content

Instantly share code, notes, and snippets.

@mnapoli
Created February 24, 2014 14:39
Show Gist options
  • Save mnapoli/9189509 to your computer and use it in GitHub Desktop.
Save mnapoli/9189509 to your computer and use it in GitHub Desktop.
<?php
trait class ABetterNameHere
{
public function someGenericMethod()
{
// ...
}
}
// Still generic definition of a sortable entity (text blocks or such)
trait ModelWithPositionField
{
private $position;
public function setPosition($newPosition)
{
$this->position = $newPosition;
}
}
// Another generic definition of an entity with some given functionality that might be of use for multiple concrete entities
trait ModelWithSomeOtherFunctionality
{
public function someOtherMethod()
{
// ...
}
}
class ActualEntityModel
{
use ABetterNameHere;
use ModelWithPositionField;
use ModelWithSomeOtherFunctionality;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment