File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -561,4 +561,25 @@ public function getOptions()
561561 return $ this ->options ;
562562 }
563563
564+
565+ /********************* extension methods ****************d*g**/
566+
567+
568+ public function __call ($ name , $ args )
569+ {
570+ if ($ callback = Nette \Utils \ObjectMixin::getExtensionMethod (get_class ($ this ), $ name )) {
571+ return Nette \Utils \Callback::invoke ($ callback , $ this , ...$ args );
572+ }
573+ return parent ::__call ($ name , $ args );
574+ }
575+
576+
577+ public static function extensionMethod ($ name , $ callback = NULL )
578+ {
579+ if (strpos ($ name , ':: ' ) !== FALSE ) { // back compatibility
580+ list (, $ name ) = explode (':: ' , $ name );
581+ }
582+ Nette \Utils \ObjectMixin::setExtensionMethod (get_called_class (), $ name , $ callback );
583+ }
584+
564585}
You can’t perform that action at this time.
0 commit comments