@@ 613-632 (lines=20) @@ | ||
610 | * @param $name string The $name argument is the name of the method being called. |
|
611 | * @param $arguments arra The $arguments argument is an enumerated array containing the parameters passed to the $name'ed method. |
|
612 | */ |
|
613 | public static function __callStatic($method, $arguments) |
|
614 | { |
|
615 | // Debug message for Method Overloading |
|
616 | // Making it easier to see which static method is called magically |
|
617 | //\Koch\Debug\Debug::firebug('DEBUG (Overloading): Calling static method "'.$method.'" '. implode(', ', $arguments). "\n"); |
|
618 | // construct the filename of the command |
|
619 | $filename = __DIR__ . '/Pool/' . $method . '.php'; |
|
620 | ||
621 | // check if name is valid |
|
622 | if (is_file($filename) && is_readable($filename)) { |
|
623 | // dynamically include the command |
|
624 | include_once $filename; |
|
625 | ||
626 | return call_user_func_array($method, $arguments); |
|
627 | } else { |
|
628 | throw new \RuntimeException( |
|
629 | sprintf('Koch Framework Function not found: "%s".', $filename) |
|
630 | ); |
|
631 | } |
|
632 | } |
|
633 | ||
634 | /** |
|
635 | * The Magic Call __call() is triggered when invoking inaccessible methods in an object context. |
|
@@ 646-668 (lines=23) @@ | ||
643 | * @param $name string The $name argument is the name of the method being called. |
|
644 | * @param $arguments array The $arguments argument is an enumerated array containing the parameters passed to the $name'ed method. |
|
645 | */ |
|
646 | public function __call($method, $arguments) |
|
647 | { |
|
648 | // Because value of $name is case sensitive, its forced to be lowercase. |
|
649 | $method = mb_strtolower($method); |
|
650 | ||
651 | // Debug message for Method Overloading |
|
652 | // Making it easier to see which method is called magically |
|
653 | // \Koch\Debug\Debug::fbg('DEBUG (Overloading): Calling object method "'.$method.'" '. implode(', ', $arguments). "\n"); |
|
654 | // construct the filename of the command |
|
655 | $filename = __DIR__ . '/pool/' . $method . '.php'; |
|
656 | ||
657 | // check if name is valid |
|
658 | if (is_file($filename) && is_readable($filename)) { |
|
659 | // dynamically include the command |
|
660 | include_once $filename; |
|
661 | ||
662 | return call_user_func_array($method, $arguments); |
|
663 | } else { |
|
664 | throw new \RuntimeException( |
|
665 | sprintf('Koch Framework Function not found: "%s".', $filename) |
|
666 | ); |
|
667 | } |
|
668 | } |
|
669 | } |
|
670 |