1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* PHP: Nelson Martell Library file |
5
|
|
|
* |
6
|
|
|
* Copyright © 2016-2021 Nelson Martell (http://nelson6e65.github.io) |
7
|
|
|
* |
8
|
|
|
* Licensed under The MIT License (MIT) |
9
|
|
|
* For full copyright and license information, please see the LICENSE |
10
|
|
|
* Redistributions of files must retain the above copyright notice. |
11
|
|
|
* |
12
|
|
|
* @copyright 2016-2021 Nelson Martell |
13
|
|
|
* @link http://nelson6e65.github.io/php_nml/ |
14
|
|
|
* @since v0.6.0 |
15
|
|
|
* @license http://www.opensource.org/licenses/mit-license.php The MIT License (MIT) |
16
|
|
|
* */ |
17
|
|
|
|
18
|
|
|
namespace NelsonMartell\Test\DataProviders\ExampleClass; |
19
|
|
|
|
20
|
|
|
use NelsonMartell\PropertiesHandler; |
21
|
|
|
use NelsonMartell\IStrictPropertiesContainer; |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* Example class to be used in PropertiesHandler test. |
25
|
|
|
* Not customized. |
26
|
|
|
* |
27
|
|
|
* Prefixes in member names: |
28
|
|
|
* 'property': using getter or setter; |
29
|
|
|
* 'attribute': direct access |
30
|
|
|
*/ |
31
|
|
|
class A implements IStrictPropertiesContainer |
32
|
|
|
{ |
33
|
|
|
use PropertiesHandler; |
34
|
|
|
|
35
|
|
|
public function __construct() |
36
|
|
|
{ |
37
|
|
|
// Unset the wrappers |
38
|
|
|
unset( |
39
|
|
|
$this->property1, |
40
|
|
|
$this->property3 |
41
|
|
|
); |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* This should not be accesible from external or inherited clases. |
46
|
|
|
* @var [type] |
|
|
|
|
47
|
|
|
*/ |
48
|
|
|
private $attribute1 = -1; |
49
|
|
|
public $property1; |
50
|
|
|
|
51
|
|
|
public function getProperty1() |
52
|
|
|
{ |
53
|
|
|
return $this->attribute1; |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
protected $attribute2 = -2; |
57
|
|
|
|
58
|
|
|
public function getAttribute2() |
59
|
|
|
{ |
60
|
|
|
// Only from external will use this getter |
61
|
|
|
return $this->attribute2; |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
private $attribute3 = -3; |
65
|
|
|
private $property3; |
66
|
|
|
|
67
|
|
|
public function getProperty3() |
68
|
|
|
{ |
69
|
|
|
return $this->attribute3; |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
public function setProperty3($value) |
73
|
|
|
{ |
74
|
|
|
$this->attribute3 = $value * 100; |
75
|
|
|
} |
76
|
|
|
|
77
|
|
|
protected $attribute4 = -4; |
78
|
|
|
} |
79
|
|
|
|