Skip to content

Commit 41a6e63

Browse files
committed
Update TransformerAnnotation.php
1 parent 43463f6 commit 41a6e63

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed
Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,32 @@
11
<?php
2-
32
namespace Ubiquity\annotations;
43

54
/**
65
* Annotation Transformer.
76
* usage :
87
* - transformer("name"=>"transformerName")
8+
* - transformer("transformerName")
99
*
1010
* @author jc
11-
* @version 1.0.1
11+
* @version 1.0.2
1212
* @usage('property'=>true, 'inherited'=>true)
1313
* @since Ubiquity 2.1.1
1414
*/
1515
class TransformerAnnotation extends BaseAnnotation {
16+
1617
public $name;
1718

1819
/**
1920
* Initialize the annotation.
2021
*/
2122
public function initAnnotation(array $properties) {
22-
if (isset ( $properties [0] )) {
23-
$this->name = $properties [0];
24-
unset ( $properties [0] );
23+
if (isset($properties[0])) {
24+
$this->name = $properties[0];
25+
unset($properties[0]);
26+
} else if (isset($properties['name'])) {
27+
$this->name = $properties['name'];
2528
} else {
26-
throw new \Exception ( 'Transformer annotation must have a name' );
29+
throw new \Exception('Transformer annotation must have a name');
2730
}
2831
}
2932
}

0 commit comments

Comments
 (0)