Completed
Push — develop ( bc6cb3...7609bb )
by
unknown
17:07 queued 09:15
created

ViewModelTemplateFilterAbstract::setDescription()   B

Complexity

Conditions 5
Paths 5

Size

Total Lines 14
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 14
rs 8.8571
cc 5
eloc 8
nc 5
nop 0
1
<?php
2
/**
3
 * YAWIK
4
 *
5
 * @filesource
6
 * @copyright (c) 2013-2015 Cross Solution (http://cross-solution.de)
7
 * @license   MIT
8
 * @author    [email protected]
9
 */
10
11
12
namespace Jobs\Filter;
13
14
use Jobs\Entity\Job;
15
use Zend\Filter\FilterInterface;
16
use Zend\View\Model\ViewModel;
17
18
/**
19
 * assembles a ViewModel for job templates.
20
 * this class needs to be extended for specific assignments
21
 * Class viewModelTemplateFilterAbstract
22
 * @package Jobs\Filter
23
 */
24
abstract class ViewModelTemplateFilterAbstract implements FilterInterface
0 ignored issues
show
Coding Style introduced by
ViewModelTemplateFilterAbstract does not seem to conform to the naming convention (^Abstract|Factory$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
25
{
26
27
    /**
28
     * @var array assembles all data for the viewmodel
29
     */
30
    protected $container;
31
32
    /**
33
     * @var Job
34
     */
35
    protected $job;
36
37
    /**
38
     * @var array
39
     */
40
    protected $config;
41
42
    /**
43
     * creating absolute links like the apply-link
44
     * absolute links are needed on the server of the provider
45
     * @var
46
     */
47
    protected $urlPlugin;
48
49
    /**
50
     * also needed to create absolute links
51
     * @var
52
     */
53
    protected $basePathHelper;
54
55
    /**
56
     * @var
57
     */
58
    protected $serverUrlHelper;
59
60
    /**
61
     * @param $config
62
     */
63
    public function setConfig($config)
64
    {
65
        $this->config = $config;
66
        return;
67
    }
68
69
    /**
70
     * @param $urlPlugin
71
     */
72
    public function setUrlPlugin($urlPlugin)
73
    {
74
        $this->urlPlugin = $urlPlugin;
75
        return;
76
    }
77
78
    /**
79
     * @param $basePathHelper
80
     */
81
    public function setBasePathHelper($basePathHelper)
82
    {
83
        $this->basePathHelper = $basePathHelper;
84
        return;
85
    }
86
87
    /**
88
     * @return mixed
89
     */
90
    public function getBasePathHelper()
91
    {
92
        return $this->basePathHelper;
93
    }
94
95
    /**
96
     * @param $serverUrlHelper
97
     */
98
    public function setServerUrlHelper($serverUrlHelper)
99
    {
100
        $this->serverUrlHelper = $serverUrlHelper;
101
        return;
102
    }
103
104
    /**
105
     * @return mixed
106
     */
107
    public function getServerUrlHelper()
108
    {
109
        return $this->serverUrlHelper;
110
    }
111
112
    /**
113
     * @param mixed $value
114
     * @return mixed|ViewModel
115
     * @throws \InvalidArgumentException
116
     */
117
    public function filter($value)
118
    {
119
        $model    = new ViewModel();
120
        $this->container = array();
121
        $this->extract($value);
122
        $model->setVariables($this->container);
123
        if (!isset($this->job)) {
124
            throw new \InvalidArgumentException('cannot create a viewModel for Templates without an $job');
125
        }
126
        $model->setTemplate('templates/' . $this->job->template . '/index');
0 ignored issues
show
Documentation introduced by
The property $template is declared protected in Jobs\Entity\Job. Since you implemented __get(), maybe consider adding a @property or @property-read annotation. This makes it easier for IDEs to provide auto-completion.

Since your code implements the magic setter _set, this function will be called for any write access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

Since the property has write access only, you can use the @property-write annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
127
        return $model;
128
    }
129
130
    /**
131
     * should be overwritten
132
     * here are all assignments to container arr administered
133
     * input-attributes are the job and the configuration
134
     * output-attribute is the container
135
     * @param $value
136
     * @return mixed
137
     */
138
    abstract protected function extract($value);
139
140
    /**
141
     * Set the apply button of the job posting
142
     *
143
     * @return $this
144
     * @throws \InvalidArgumentException
145
     */
146
    protected function setUriApply()
147
    {
148
        if (!isset($this->job)) {
149
            throw new \InvalidArgumentException('cannot create a viewModel for Templates without a $job');
150
        }
151
        $atsMode = $this->job->getAtsMode();
152
        $uriApply = false;
153
        if ($atsMode->isIntern() || $atsMode->isEmail()) {
154
            $uriApply = $this->urlPlugin->fromRoute('lang/apply', array('applyId' => $this->job->applyId), array('force_canonical' => true));
0 ignored issues
show
Documentation introduced by
The property $applyId is declared protected in Jobs\Entity\Job. Since you implemented __get(), maybe consider adding a @property or @property-read annotation. This makes it easier for IDEs to provide auto-completion.

Since your code implements the magic setter _set, this function will be called for any write access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

Since the property has write access only, you can use the @property-write annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
155
        } elseif ($atsMode->isUri()) {
156
            $uriApply = $atsMode->getUri();
157
        }
158
        $this->container['uriApply'] = $uriApply;
159
        return $this;
160
    }
161
162
    /**
163
     * Sets the location of a jobs
164
     *
165
     * @return $this
166
     * @throws \InvalidArgumentException
167
     */
168
    protected function setLocation()
169
    {
170
        if (!isset($this->job)) {
171
            throw new \InvalidArgumentException('cannot create a viewModel for Templates without aa $job');
172
        }
173
        $location = $this->job->getLocation();
174
        $this->container['location'] = isset($location)?$location:'';
175
        return $this;
176
    }
177
178
    /**
179
     * Sets the company description of a job. Use the description of an organization as default
180
     *
181
     * @return $this
182
     * @throws \InvalidArgumentException
183
     */
184
    protected function setDescription()
185
    {
186
        if (!isset($this->job)) {
187
            throw new \InvalidArgumentException('cannot create a viewModel for Templates without a $job');
188
        }
189
190
        if (empty($this->job->templateValues->description) && isset($this->job->organization)) {
0 ignored issues
show
Documentation introduced by
The property $templateValues is declared protected in Jobs\Entity\Job. Since you implemented __get(), maybe consider adding a @property or @property-read annotation. This makes it easier for IDEs to provide auto-completion.

Since your code implements the magic setter _set, this function will be called for any write access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

Since the property has write access only, you can use the @property-write annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
Documentation introduced by
The property $organization is declared protected in Jobs\Entity\Job. Since you implemented __get(), maybe consider adding a @property or @property-read annotation. This makes it easier for IDEs to provide auto-completion.

Since your code implements the magic setter _set, this function will be called for any write access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

Since the property has write access only, you can use the @property-write annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
Documentation introduced by
The property description does not exist on object<Jobs\Entity\TemplateValues>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
191
            $this->job->templateValues->description = $this->job->organization->description;
0 ignored issues
show
Documentation introduced by
The property $templateValues is declared protected in Jobs\Entity\Job. Since you implemented __get(), maybe consider adding a @property or @property-read annotation. This makes it easier for IDEs to provide auto-completion.

Since your code implements the magic setter _set, this function will be called for any write access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

Since the property has write access only, you can use the @property-write annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
Documentation introduced by
The property $organization is declared protected in Jobs\Entity\Job. Since you implemented __get(), maybe consider adding a @property or @property-read annotation. This makes it easier for IDEs to provide auto-completion.

Since your code implements the magic setter _set, this function will be called for any write access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

Since the property has write access only, you can use the @property-write annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
Documentation introduced by
The property description does not exist on object<Jobs\Entity\TemplateValues>. Since you implemented __set, maybe consider adding a @property annotation.

Since your code implements the magic setter _set, this function will be called for any write access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

Since the property has write access only, you can use the @property-write annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
Bug introduced by
Accessing description on the interface Organizations\Entity\OrganizationInterface suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
192
        }
193
        $description = $this->job->templateValues->description;
0 ignored issues
show
Documentation introduced by
The property $templateValues is declared protected in Jobs\Entity\Job. Since you implemented __get(), maybe consider adding a @property or @property-read annotation. This makes it easier for IDEs to provide auto-completion.

Since your code implements the magic setter _set, this function will be called for any write access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

Since the property has write access only, you can use the @property-write annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
Documentation introduced by
The property description does not exist on object<Jobs\Entity\TemplateValues>. Since you implemented __set, maybe consider adding a @property annotation.

Since your code implements the magic setter _set, this function will be called for any write access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

Since the property has write access only, you can use the @property-write annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
194
195
        $this->container['description'] = isset($description)?$description:'';
196
        return $this;
197
    }
198
199
    /**
200
     * Sets the organizations contact address
201
     *
202
     * @return $this
203
     * @throws \InvalidArgumentException
204
     */
205
    protected function setOrganizationInfo()
206
    {
207
        if (!isset($this->job)) {
208
            throw new \InvalidArgumentException('cannot create a viewModel for Templates without a $job');
209
        }
210
        $organizationName = '';
211
        $organizationStreet = '';
212
        $organizationPostalCode = '';
213
        $organizationPostalCity = '';
214
        $organization = $this->job->organization;
0 ignored issues
show
Documentation introduced by
The property $organization is declared protected in Jobs\Entity\Job. Since you implemented __get(), maybe consider adding a @property or @property-read annotation. This makes it easier for IDEs to provide auto-completion.

Since your code implements the magic setter _set, this function will be called for any write access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

Since the property has write access only, you can use the @property-write annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
215
        if (isset($organization)) {
216
            $organizationName = $organization->organizationName->name;
0 ignored issues
show
Bug introduced by
Accessing organizationName on the interface Organizations\Entity\OrganizationInterface suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
217
            $organizationStreet = $organization->contact->street.' '.$organization->contact->houseNumber;
0 ignored issues
show
Bug introduced by
Accessing contact on the interface Organizations\Entity\OrganizationInterface suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
218
            $organizationPostalCode = $organization->contact->postalcode;
0 ignored issues
show
Bug introduced by
Accessing contact on the interface Organizations\Entity\OrganizationInterface suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
219
            $organizationPostalCity = $organization->contact->city;
0 ignored issues
show
Bug introduced by
Accessing contact on the interface Organizations\Entity\OrganizationInterface suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
220
        }
221
        $this->container['organizationName'] = $organizationName;
222
        $this->container['street'] = $organizationStreet;
223
        $this->container['postalCode'] = $organizationPostalCode;
224
        $this->container['city'] = $organizationPostalCity;
225
226
        if (isset($organization) && isset($organization->image) && $organization->image->uri) {
0 ignored issues
show
Bug introduced by
Accessing image on the interface Organizations\Entity\OrganizationInterface suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
227
            $this->container['uriLogo'] = $this->makeAbsolutePath($organization->image->uri);
0 ignored issues
show
Bug introduced by
Accessing image on the interface Organizations\Entity\OrganizationInterface suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
228
        } else {
229
            $this->container['uriLogo'] = $this->makeAbsolutePath($this->config->default_logo);
230
        }
231
        return $this;
232
    }
233
234
    /**
235
     * Sets the template
236
     *
237
     * @return $this
238
     */
239
    protected function setTemplate()
240
    {
241
        $this->container['templateName'] = $this->job->template;
0 ignored issues
show
Documentation introduced by
The property $template is declared protected in Jobs\Entity\Job. Since you implemented __get(), maybe consider adding a @property or @property-read annotation. This makes it easier for IDEs to provide auto-completion.

Since your code implements the magic setter _set, this function will be called for any write access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

Since the property has write access only, you can use the @property-write annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
242
        return $this;
243
    }
244
245
    /**
246
     * combines two helper
247
     *
248
     * @param $path
249
     * @return mixed
250
     */
251
    protected function makeAbsolutePath($path)
252
    {
253
        $path = $this->serverUrlHelper->__invoke($this->basePathHelper->__invoke($path));
254
        return $path;
255
    }
256
}
257