Skip to content

Commit 6a5154e

Browse files
committed
fix coding standard violations
1 parent 75a3ded commit 6a5154e

File tree

1 file changed

+83
-66
lines changed

1 file changed

+83
-66
lines changed

src/annotations/standard/PropertyAnnotation.php

Lines changed: 83 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -21,74 +21,91 @@
2121

2222
/**
2323
* Defines a magic/virtual property and it's type
24+
*
2425
* @usage('class'=>true, 'inherited'=>true)
2526
*/
2627
class PropertyAnnotation extends Annotation implements IAnnotationParser, IAnnotationFileAware
2728
{
28-
/**
29-
* @var string Specifies the property type
30-
*/
31-
public $type;
32-
/**
33-
* @var string Specifies the property name
34-
*/
35-
public $name;
36-
/**
37-
* @var string Specifies the property description
38-
*/
39-
public $description;
40-
41-
/**
42-
* Annotation file.
43-
*
44-
* @var AnnotationFile
45-
*/
46-
protected $file;
47-
48-
/**
49-
* {@inheritDoc}
50-
* @see \mindplay\annotations\IAnnotationParser::parseAnnotation()
51-
*/
52-
public static function parseAnnotation($value)
53-
{
54-
$parts = explode(' ', trim($value), 3);
55-
if (\sizeof($parts) < 2) {
56-
// Malformed value, let "initAnnotation" report about it.
57-
return array();
58-
}
59-
$result=array('type' => $parts[0], 'name' => substr($parts[1], 1));
60-
61-
if (isset($parts[2])){
62-
$result['description']=$parts[2];
63-
}
64-
return $result;
65-
}
66-
67-
/**
68-
* Initialize the annotation.
69-
*/
70-
public function initAnnotation(array $properties)
71-
{
72-
$this->map($properties, array('type','name','description'));
73-
parent::initAnnotation($properties);
74-
if (!isset($this->type)) {
75-
throw new AnnotationException(basename(__CLASS__).' requires a type property');
76-
}
77-
if (!isset($this->name)) {
78-
throw new AnnotationException(basename(__CLASS__).' requires a name property');
79-
}
80-
$this->type = $this->file->resolveType($this->type);
81-
}
82-
83-
/**
84-
* Provides information about file, that contains this annotation.
85-
*
86-
* @param AnnotationFile $file Annotation file.
87-
*
88-
* @return void
89-
*/
90-
public function setAnnotationFile(AnnotationFile $file)
91-
{
92-
$this->file = $file;
93-
}
29+
/**
30+
* Specifies the property type
31+
*
32+
* @var string
33+
*/
34+
public $type;
35+
36+
/**
37+
* Specifies the property name
38+
*
39+
* @var string
40+
*/
41+
public $name;
42+
43+
/**
44+
* Specifies the property description
45+
*
46+
* @var string
47+
*/
48+
public $description;
49+
50+
/**
51+
* Annotation file.
52+
*
53+
* @var AnnotationFile
54+
*/
55+
protected $file;
56+
57+
/**
58+
* @param string $value The raw string value of the Annotation.
59+
*
60+
* @return array An array of Annotation properties.
61+
*/
62+
public static function parseAnnotation($value)
63+
{
64+
$parts = explode(' ', trim($value), 3);
65+
66+
if (\sizeof($parts) < 2) {
67+
// Malformed value, let "initAnnotation" report about it.
68+
return array();
69+
}
70+
71+
$result = array('type' => $parts[0], 'name' => substr($parts[1], 1));
72+
73+
if (isset($parts[2])) {
74+
$result['description'] = $parts[2];
75+
}
76+
77+
return $result;
78+
}
79+
80+
/**
81+
* Initialize the annotation.
82+
*/
83+
public function initAnnotation(array $properties)
84+
{
85+
$this->map($properties, array('type', 'name', 'description'));
86+
87+
parent::initAnnotation($properties);
88+
89+
if (!isset($this->type)) {
90+
throw new AnnotationException(basename(__CLASS__).' requires a type property');
91+
}
92+
93+
if (!isset($this->name)) {
94+
throw new AnnotationException(basename(__CLASS__).' requires a name property');
95+
}
96+
97+
$this->type = $this->file->resolveType($this->type);
98+
}
99+
100+
/**
101+
* Provides information about file, that contains this annotation.
102+
*
103+
* @param AnnotationFile $file Annotation file.
104+
*
105+
* @return void
106+
*/
107+
public function setAnnotationFile(AnnotationFile $file)
108+
{
109+
$this->file = $file;
110+
}
94111
}

0 commit comments

Comments
 (0)