setUpperCaseWithDifferentSetterProperty()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
1
<?php
2
3
/**
4
 * PHP: Nelson Martell Library file
5
 *
6
 * Copyright © 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 2021 Nelson Martell
13
 * @link      http://nelson6e65.github.io/php_nml/
14
 * @since     v1.0.0
15
 * @license   http://www.opensource.org/licenses/mit-license.php The MIT License (MIT)
16
 * */
17
18
declare(strict_types=1);
19
20
namespace NelsonMartell\Test\DataProviders\ExampleClass;
21
22
use NelsonMartell\StrictObject;
23
use NelsonMartell\PropertiesHandler;
24
use NelsonMartell\IMagicPropertiesContainer;
25
use NelsonMartell\IStrictPropertiesContainer;
26
use stdClass as VeryLongClassName;
27
28
/**
29
 * @internal
30
 *
31
 * @property string $UpperCaseProperty
32
 * @property-read string $UpperCaseWithDifferentSetterProperty
33
 * @property-write string|int $UpperCaseWithDifferentSetterProperty
34
 * @property-read VeryLongClassName|null $propertyWithLongClass  Officia deserunt mollit anim id est laborum.
35
 * @property-write VeryLongClassName|int|null $propertyWithLongClass Lorem ipsum dolor sit amet.
36
 * @property-read VeryLongClassName|null  $anotherPropertyAfterPropertyWithLongClass
37
 * @property-write VeryLongClassName|int|string|null $anotherPropertyAfterPropertyWithLongClass
38
 */
39
class WithManyMagicPropertiesClass implements IStrictPropertiesContainer, IMagicPropertiesContainer
40
{
41
    use PropertiesHandler;
42
43
    /**
44
     * @var array
45
     */
46
    private $data = [];
47
48
    public function __construct()
49
    {
50
    }
51
52
53
    /**
54
     *
55
     *
56
     * @return string
57
     */
58
    protected function getUpperCaseProperty(): string
59
    {
60
        return $this->data['UpperCaseProperty'] ?? '';
61
    }
62
63
    /**
64
     *
65
     * @param string|int $value
66
     */
67
    protected function setUpperCaseProperty($value)
68
    {
69
        $this->data['UpperCaseProperty'] = "${value}";
70
    }
71
72
    /**
73
     *
74
     *
75
     * @return string
76
     */
77
    protected function getUpperCaseWithDifferentSetterProperty(): string
78
    {
79
        return $this->data['UpperCaseWithDifferentSetterProperty'] ?? '';
80
    }
81
82
    /**
83
     *
84
     * @param string|int $value
85
     */
86
    protected function setUpperCaseWithDifferentSetterProperty($value)
87
    {
88
        $this->data['UpperCaseWithDifferentSetterProperty'] = "${value}";
89
    }
90
91
    /**
92
     * @return VeryLongClassName|null
93
     */
94
    protected function getPropertyWithLongClass()
95
    {
96
        return $this->data['propertyWithLongClass'] ?? null;
97
    }
98
99
    /**
100
     * @param VeryLongClassName|int|null $value
101
     */
102
    protected function setPropertyWithLongClass($value)
103
    {
104
        if ($value !== null && !($value instanceof VeryLongClassName)) {
105
            $original        = $value;
106
            $value           = new VeryLongClassName();
107
            $value->original = $original;
108
        }
109
110
        $this->data['propertyWithLongClass'] = $value;
111
    }
112
113
114
    /**
115
     * @return VeryLongClassName|null
116
     */
117
    protected function getAnotherPropertyAfterPropertyWithLongClass()
118
    {
119
        return $this->data['anotherPropertyAfterPropertyWithLongClass'] ?? null;
120
    }
121
122
    /**
123
     * @param VeryLongClassName|int|string|null $value
124
     */
125
    protected function setAnotherPropertyAfterPropertyWithLongClass($value)
126
    {
127
        if ($value !== null && !($value instanceof VeryLongClassName)) {
128
            $original        = $value;
129
            $value           = new VeryLongClassName();
130
            $value->original = $original;
131
        }
132
133
        $this->data['anotherPropertyAfterPropertyWithLongClass'] = $value;
134
    }
135
}
136