Created
January 4, 2016 00:33
-
-
Save lkwdwrd/f1ec41e1c388a36639a2 to your computer and use it in GitHub Desktop.
Reflector Decorator Play
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace WP_Parser\Reflection; | |
use WP_Parser\Reflection\Reflector_Meta; | |
final class Reflector_Decorator { | |
use Reflector_Meta; | |
private $_reflector; | |
public function __construct( $reflector ) { | |
$this->_reflector = $reflector; | |
} | |
public function __call( $method, $args ) { | |
if ( method_exists( $this->_class_reflector, $method ) ) { | |
return call_user_func_array( array( $this->_class_reflector, $method ), $args ); | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace WP_Parser\Reflection; | |
trait Reflector_Meta { | |
private $_meta = array(); | |
public function addMeta( $name, $value ) { | |
$this->_meta[ $name ] = $value; | |
} | |
public function getMeta( $name ) { | |
return ( isset( $this->_meta[ $name ] ) ) ? $this->_meta[ $name ] : null; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment