1 | <?php |
||
47 | abstract class AbstractWorker |
||
48 | { |
||
49 | /** |
||
50 | * Object to delete |
||
51 | * |
||
52 | * @var mixed |
||
53 | */ |
||
54 | protected $entity; |
||
55 | |||
56 | /** |
||
57 | * Defined Registry to work with |
||
58 | * |
||
59 | * @var Registry |
||
60 | */ |
||
61 | protected $registry; |
||
62 | |||
63 | /** |
||
64 | * Prevent many workers to work on the same entity |
||
65 | * |
||
66 | * @var array |
||
67 | */ |
||
68 | protected static $working = array(); |
||
69 | |||
70 | /** |
||
71 | * Constructor |
||
72 | * |
||
73 | * @param mixed $entity The object involved with this worker |
||
74 | * |
||
75 | * @return void |
||
|
|||
76 | */ |
||
77 | public function __construct($entity) |
||
81 | |||
82 | /** |
||
83 | * Return the registry to be used by this worker |
||
84 | * |
||
85 | * @return Registry |
||
86 | */ |
||
87 | public function getRegistry() |
||
92 | |||
93 | /** |
||
94 | * Defines the Registry to work with. |
||
95 | * |
||
96 | * @param Registry $registry The registry to be used by this worker |
||
97 | * |
||
98 | * @return void |
||
99 | */ |
||
100 | public function setRegistry(Registry $registry) |
||
104 | |||
105 | /** |
||
106 | * Return the defined entity |
||
107 | * |
||
108 | * @return mixed |
||
109 | */ |
||
110 | public function getEntity() |
||
115 | |||
116 | /** |
||
117 | * Unmark the entity from the working scope |
||
118 | * |
||
119 | * @param object $entity The entity |
||
120 | * |
||
121 | * @return void |
||
122 | */ |
||
123 | protected function removeFromWorking($entity) |
||
130 | } |
Adding a
@return
annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.