forked from LeCoupa/awesome-cheatsheets
-
Notifications
You must be signed in to change notification settings - Fork 1
/
php.php
235 lines (201 loc) · 4.96 KB
/
php.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
<?php
/**
* Class
* http://php.net/manual/en/language.oop5.basic.php
*/
class NormalClass extends AbstractClassName implements InterfaceName
{
use TraitName;
// --> PROPERTY TYPES <--
/**
* Public property, everyone can access this property.
* @var Type
*/
public $property;
/**
* Private property, only this instance can access this property.
* @var Type
*/
private $property;
/**
* Protected property, this instance and childs can access this property.
* @var Type
*/
protected $property;
/**
* Static property, is the same for all instances of this class.
* @var Type
*/
static $property;
// --> FUNCTION TYPES <--
/**
* Public function, everyone can access this function.
* @param Type
* @return Type
*/
public function publicFunction(Type $var = null): Type
{
}
/**
* Private function, only this instance can access this function.
* @param Type
* @return Type
*/
private function privateFunction(Type $var = null): Type
{
}
/**
* Protected function, this instance and childs can access this function.
* @param Type
* @return Type
*/
protected function protectedFunction(Type $var = null): Type
{
}
/**
* Static function, doesn't need an instance to be executed.
* @param Type
* @return Type
*/
public static function staticFunction(Type $var = null): Type
{
}
// --> MAGIC METHODS <--
/**
* Gets triggered on creating a new class instance
* http://php.net/manual/en/language.oop5.decon.php
* @param Type
* @return void
*/
public function __construct(Type $var = null)
{
}
/**
* Gets triggered on destruction of a class instance
* http://php.net/manual/en/language.oop5.decon.php
* @return void
*/
public function __destruct()
{
}
/**
* __set() is run when writing data to inaccessible properties.
* http://php.net/manual/en/language.oop5.overloading.php
* @param string name
* @param mixed value
* @return void
*/
public function __set(string $name , mixed $value)
{
}
/**
* __get() is utilized for reading data from inaccessible properties.
* http://php.net/manual/en/language.oop5.overloading.php
* @param string name
* @return mixed
*/
public function __get(string $name)
{
}
/**
* __isset() is triggered by calling isset() or empty() on inaccessible properties.
* http://php.net/manual/en/language.oop5.overloading.php
* @param string name
* @return bool
*/
public function __isset(string $name)
{
}
/**
* __unset() is invoked when unset() is used on inaccessible properties.
* http://php.net/manual/en/language.oop5.overloading.php
* @param string name
* @return void
*/
public function __unset(string $name)
{
}
/**
* __call is triggered when invoking inaccessible methods in an object context.
* http://php.net/manual/en/language.oop5.overloading.php
* @param string name
* @param array arguments
* @return mixed
*/
public function __call(string $name, array $arguments)
{
}
/**
* __callStatic() is triggered when invoking inaccessible methods in a static context.
* http://php.net/manual/en/language.oop5.overloading.php
* @param string name
* @param array arguments
* @return mixed
*/
public static function __callStatic(string $name, array $arguments)
{
}
/**
* http://php.net/manual/en/language.oop5.magic.php
* @return array
*/
public function __sleep()
{
}
/**
* http://php.net/manual/en/language.oop5.magic.php
* @return void
*/
public function __wakeup()
{
}
/**
* http://php.net/manual/en/language.oop5.magic.php
* @return string
*/
public function __toString()
{
}
/**
* http://php.net/manual/en/language.oop5.magic.php
* @param Type
* @return mixed
*/
public function __invoke(Type $var = null)
{
}
/**
* http://php.net/manual/en/language.oop5.magic.php
* @param array properties
* @return object
*/
public static function __set_state(array $properties)
{
}
/**
* http://php.net/manual/en/language.oop5.magic.php
* @return array
*/
public function __debugInfo()
{
}
}
/**
* Every class that has implemented this interface need to have the same functions.
*/
interface InterfaceName
{
public function FunctionName(Type $var = null): Type;
}
/**
* Combination of class and interface.
*/
abstract class AbstractClassName
{
/**
* Classes extending this abstract class need to have this function.
* @param Type
* @return Type
*/
abstract function abstractFunction(Type $var = null): Type;
}