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()
446446 }
447447
448448
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+
449461 /**
450462 * @param string without $
451463 * @param mixed
@@ -483,6 +495,18 @@ public function getMethods()
483495 }
484496
485497
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+
486510 /**
487511 * @param string
488512 * @return Method
Original file line number Diff line number Diff line change @@ -34,15 +34,19 @@ $class->addProperty('handle')
3434$ class ->addProperty ('order ' )
3535 ->setValue (new PhpLiteral ('RecursiveIteratorIterator::SELF_FIRST ' ));
3636
37- $ class ->addProperty ('sections ' , array ('first ' => TRUE ))
37+ $ p = $ class ->addProperty ('sections ' , array ('first ' => TRUE ))
3838 ->setStatic (TRUE );
3939
40- $ class ->addMethod ('getHandle ' )
40+ Assert::same ($ p , $ class ->getProperty ('sections ' ));
41+
42+ $ m = $ class ->addMethod ('getHandle ' )
4143 ->addDocument ('Returns file handle. ' )
4244 ->addDocument ('@return resource ' )
4345 ->setFinal (TRUE )
4446 ->setBody ('return $this->?; ' , array ('handle ' ));
4547
48+ Assert::same ($ m , $ class ->getMethod ('getHandle ' ));
49+
4650$ class ->addMethod ('getSections ' )
4751 ->setStatic (TRUE )
4852 ->setVisibility ('protected ' )
You can’t perform that action at this time.
0 commit comments