mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-08-26 12:36:07 +02:00
Cleanup of framework's use of @package and @subpackage labels and additional of labels for classes missing packages. Moved all GridField related components to the one name. Countless spelling fixes, grammar for other comments. Link ClassName references in file headers.
39 lines
828 B
PHP
39 lines
828 B
PHP
<?php
|
|
|
|
/**
|
|
* A class that proxies another, allowing various functionality to be
|
|
* injected.
|
|
*
|
|
* @package framework
|
|
* @subpackage injector
|
|
*/
|
|
class AopProxyService {
|
|
public $beforeCall = array();
|
|
|
|
public $afterCall = array();
|
|
|
|
public $proxied;
|
|
|
|
public function __call($method, $args) {
|
|
if (method_exists($this->proxied, $method)) {
|
|
$continue = true;
|
|
if (isset($this->beforeCall[$method])) {
|
|
$result = $this->beforeCall[$method]->beforeCall($this->proxied, $method, $args);
|
|
if ($result === false) {
|
|
$continue = false;
|
|
}
|
|
}
|
|
|
|
if ($continue) {
|
|
$result = call_user_func_array(array($this->proxied, $method), $args);
|
|
|
|
if (isset($this->afterCall[$method])) {
|
|
$this->afterCall[$method]->afterCall($this->proxied, $method, $args, $result);
|
|
}
|
|
|
|
return $result;
|
|
}
|
|
}
|
|
}
|
|
}
|