This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | /** |
||
4 | * Copyright 2015 BuzzBoard, Inc. |
||
5 | * |
||
6 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||
7 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||
8 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
||
9 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||
10 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
||
11 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
||
12 | * DEALINGS IN THE SOFTWARE. |
||
13 | * |
||
14 | */ |
||
15 | |||
16 | namespace BuzzBoard; |
||
17 | |||
18 | use BuzzBoard\Helpers\Text; |
||
19 | use BuzzBoard\Helpers\Url; |
||
20 | use BuzzBoard\Helpers\Time; |
||
21 | use BuzzBoard\Network\Http; |
||
22 | use BuzzBoard\Exceptions\InvalidArgumentException; |
||
23 | |||
24 | /** |
||
25 | * Class BuzzBoard\Profile |
||
26 | * |
||
27 | * @package BuzzBoard |
||
28 | */ |
||
29 | class Profile { |
||
30 | |||
31 | const PROFILE_CREATED_RESPONSE_CODE = 1019; |
||
32 | |||
33 | /** |
||
34 | * |
||
35 | * @var object BuzzBoard\Client |
||
36 | */ |
||
37 | protected $client; |
||
38 | |||
39 | /** |
||
40 | * |
||
41 | * @var int Profile Id |
||
42 | */ |
||
43 | protected $id; |
||
44 | |||
45 | /** |
||
46 | * |
||
47 | * @var array |
||
48 | */ |
||
49 | protected $data = []; |
||
50 | |||
51 | /** |
||
52 | * |
||
53 | * @param \BuzzBoard\Client $client |
||
54 | */ |
||
55 | public function __construct(\BuzzBoard\Client $client) { |
||
56 | $this->client = $client; |
||
57 | # Set API Key |
||
58 | $this->data['apikey'] = $client->getKey(); |
||
59 | } |
||
60 | |||
61 | /** |
||
62 | * |
||
63 | * @param int $id |
||
64 | * @return array |
||
65 | */ |
||
66 | public function get($id = 0) { |
||
67 | |||
68 | if (!$id) { |
||
69 | throw new InvalidArgumentException(); |
||
70 | } |
||
71 | |||
72 | $this->data['id'] = $id; |
||
73 | |||
74 | $request = Http::get('listings/audit', $this->data); |
||
75 | $response = $request->getBody(); |
||
76 | |||
77 | return $response->listing; |
||
78 | } |
||
79 | |||
80 | /** |
||
81 | * |
||
82 | * @param array $data |
||
83 | * @return listing Id |
||
84 | */ |
||
85 | public function save(array $data = []) { |
||
86 | |||
87 | if (!empty($data) && self::load($data)) { |
||
88 | $request = Http::post('listings/create', $this->data); |
||
89 | $response = $request->getBody(); |
||
90 | return $response->listing->id; |
||
91 | } |
||
92 | } |
||
93 | |||
94 | /** |
||
95 | * |
||
96 | * @param int $id |
||
97 | * @return boolean |
||
98 | */ |
||
99 | public function regenerate($id = 0) { |
||
100 | |||
101 | if (!$id) { |
||
102 | throw new InvalidArgumentException(); |
||
103 | } |
||
104 | |||
105 | $this->data['id'] = $id; |
||
106 | |||
107 | $request = Http::get('listings/' . __FUNCTION__, $this->data); |
||
108 | $response = $request->getBody(); |
||
109 | |||
110 | return $response->code == Network\Response::SUCCESS_CODE ? true : false; |
||
111 | } |
||
112 | |||
113 | /** |
||
114 | * |
||
115 | * @param array $data |
||
116 | */ |
||
117 | protected function load(array $data = []) { |
||
118 | $this->business = Text::cleanBusinessName($data['business']); |
||
0 ignored issues
–
show
|
|||
119 | $this->website = Url::getHost($data['website']); |
||
0 ignored issues
–
show
The property
website does not exist on object<BuzzBoard\Profile> . Since you implemented __set , maybe consider adding a @property annotation.
Since your code implements the magic setter <?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. ![]() |
|||
120 | $this->phone = Text::cleanPhoneNumber($data['phone']); |
||
0 ignored issues
–
show
The property
phone does not exist on object<BuzzBoard\Profile> . Since you implemented __set , maybe consider adding a @property annotation.
Since your code implements the magic setter <?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. ![]() |
|||
121 | $this->street = !empty($data['address']) ? Text::clean($data['address']) : Text::clean($data['street']); |
||
0 ignored issues
–
show
The property
street does not exist on object<BuzzBoard\Profile> . Since you implemented __set , maybe consider adding a @property annotation.
Since your code implements the magic setter <?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. ![]() |
|||
122 | $this->city = Text::clean($data['city']); |
||
0 ignored issues
–
show
The property
city does not exist on object<BuzzBoard\Profile> . Since you implemented __set , maybe consider adding a @property annotation.
Since your code implements the magic setter <?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. ![]() |
|||
123 | $this->state = Text::clean($data['state']); |
||
0 ignored issues
–
show
The property
state does not exist on object<BuzzBoard\Profile> . Since you implemented __set , maybe consider adding a @property annotation.
Since your code implements the magic setter <?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. ![]() |
|||
124 | $this->zip = Text::clean($data['zip']); |
||
0 ignored issues
–
show
The property
zip does not exist on object<BuzzBoard\Profile> . Since you implemented __set , maybe consider adding a @property annotation.
Since your code implements the magic setter <?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. ![]() |
|||
125 | $this->country_code = Text::clean($data['country_code']); |
||
0 ignored issues
–
show
The property
country_code does not exist on object<BuzzBoard\Profile> . Since you implemented __set , maybe consider adding a @property annotation.
Since your code implements the magic setter <?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. ![]() |
|||
126 | $this->username = Text::clean($data['username']); |
||
0 ignored issues
–
show
The property
username does not exist on object<BuzzBoard\Profile> . Since you implemented __set , maybe consider adding a @property annotation.
Since your code implements the magic setter <?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. ![]() |
|||
127 | |||
128 | # validate |
||
129 | return self::validate(); |
||
130 | } |
||
131 | |||
132 | /** |
||
133 | * @method validate |
||
134 | * @use validates Profile fields |
||
135 | */ |
||
136 | protected function validate() { |
||
137 | if ( |
||
138 | !$this->business || |
||
0 ignored issues
–
show
The property
business does not exist on object<BuzzBoard\Profile> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?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. ![]() |
|||
139 | !$this->phone || |
||
0 ignored issues
–
show
The property
phone does not exist on object<BuzzBoard\Profile> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?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. ![]() |
|||
140 | !$this->address || |
||
0 ignored issues
–
show
The property
address does not exist on object<BuzzBoard\Profile> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?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. ![]() |
|||
141 | !$this->city || |
||
0 ignored issues
–
show
The property
city does not exist on object<BuzzBoard\Profile> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?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. ![]() |
|||
142 | !$this->state || |
||
0 ignored issues
–
show
The property
state does not exist on object<BuzzBoard\Profile> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?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. ![]() |
|||
143 | !$this->zip || |
||
0 ignored issues
–
show
The property
zip does not exist on object<BuzzBoard\Profile> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?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. ![]() |
|||
144 | !$this->country_code || |
||
0 ignored issues
–
show
The property
country_code does not exist on object<BuzzBoard\Profile> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?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. ![]() |
|||
145 | !$this->username || |
||
0 ignored issues
–
show
The property
username does not exist on object<BuzzBoard\Profile> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?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. ![]() |
|||
146 | // website url validation |
||
147 | (!empty($this->website) && Url::isValid($this->website) === false) |
||
0 ignored issues
–
show
The property
website does not exist on object<BuzzBoard\Profile> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?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. ![]() |
|||
148 | ) { |
||
149 | throw new Exceptions\ProfileValidationFailed(); |
||
150 | } |
||
151 | |||
152 | return true; |
||
153 | } |
||
154 | |||
155 | /** |
||
156 | * @param string $name |
||
157 | * @param mixed $value |
||
158 | * |
||
159 | * @return void |
||
160 | */ |
||
161 | public function __set($name, $value) { |
||
162 | $this->data[(string) $name] = $value; |
||
163 | } |
||
164 | |||
165 | /** |
||
166 | * @param string $name |
||
167 | * |
||
168 | * @return mixed|null |
||
169 | */ |
||
170 | public function __get($name) { |
||
171 | if (array_key_exists($name, $this->data)) { |
||
172 | return $this->data[(string) $name]; |
||
173 | } else { |
||
174 | return null; |
||
175 | } |
||
176 | } |
||
177 | |||
178 | } |
||
179 |
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.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.