File tree Expand file tree Collapse file tree 2 files changed +30
-2
lines changed Expand file tree Collapse file tree 2 files changed +30
-2
lines changed Original file line number Diff line number Diff line change @@ -446,6 +446,18 @@ public function getProperties()
446
446
}
447
447
448
448
449
+ /**
450
+ * @return Property
451
+ */
452
+ public function getProperty ($ name )
453
+ {
454
+ if (!isset ($ this ->properties [$ name ])) {
455
+ throw new Nette \InvalidArgumentException ("Property ' $ name' not found. " );
456
+ }
457
+ return $ this ->properties [$ name ];
458
+ }
459
+
460
+
449
461
/**
450
462
* @param string without $
451
463
* @param mixed
@@ -483,6 +495,18 @@ public function getMethods()
483
495
}
484
496
485
497
498
+ /**
499
+ * @return Method
500
+ */
501
+ public function getMethod ($ name )
502
+ {
503
+ if (!isset ($ this ->methods [$ name ])) {
504
+ throw new Nette \InvalidArgumentException ("Method ' $ name' not found. " );
505
+ }
506
+ return $ this ->methods [$ name ];
507
+ }
508
+
509
+
486
510
/**
487
511
* @param string
488
512
* @return Method
Original file line number Diff line number Diff line change @@ -34,15 +34,19 @@ $class->addProperty('handle')
34
34
$ class ->addProperty ('order ' )
35
35
->setValue (new PhpLiteral ('RecursiveIteratorIterator::SELF_FIRST ' ));
36
36
37
- $ class ->addProperty ('sections ' , array ('first ' => TRUE ))
37
+ $ p = $ class ->addProperty ('sections ' , array ('first ' => TRUE ))
38
38
->setStatic (TRUE );
39
39
40
- $ class ->addMethod ('getHandle ' )
40
+ Assert::same ($ p , $ class ->getProperty ('sections ' ));
41
+
42
+ $ m = $ class ->addMethod ('getHandle ' )
41
43
->addDocument ('Returns file handle. ' )
42
44
->addDocument ('@return resource ' )
43
45
->setFinal (TRUE )
44
46
->setBody ('return $this->?; ' , array ('handle ' ));
45
47
48
+ Assert::same ($ m , $ class ->getMethod ('getHandle ' ));
49
+
46
50
$ class ->addMethod ('getSections ' )
47
51
->setStatic (TRUE )
48
52
->setVisibility ('protected ' )
You can’t perform that action at this time.
0 commit comments