Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 479 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
479
Dung lượng
4,3 MB
Nội dung
[...]... $method->getName(); } } return $_properties; } public function getPropertyMeta($property) { if (!isset($_meta["properties"][$property])) { $comment = $this->_getPropertyComment($property); if (!empty($comment)) { $_meta["properties"][$property] = $this->_parse($comment); } else { $_meta["properties"][$property] = null; } } return $_meta["properties"][$property]; } public function getMethodMeta($method) { if... $method->getName(); } } return $_properties; } public function getPropertyMeta($property) { if (!isset($_meta["properties"][$property])) { $comment = $this->_getPropertyComment($property); if (!empty($comment)) { $_meta["properties"][$property] = $this->_parse($comment); } else { $_meta["properties"][$property] = null; } } return $_meta["properties"][$property]; 23 CHAPTER 2 ■ FOUNDATION } public function getMethodMeta($method)... from within index .php PHP provides four basic statements for us to include external scripts within the program flow These are shown in Listing 2-1 Listing 2-1. The Four Basic require/include Functions include("events .php" ); include_once("inflection .php" ); require("flash .php" ); require_once("twitter .php" ); 9 CHAPTER 2 ■ FOUNDATION The first statement will look for events .php within the PHP include path,... function getClassProperties() { if (!isset($_properties)) { $properties = $this->_getClassProperties(); foreach ($properties as $property) { $_properties[] = $property->getName(); } } return $_properties; } public function getClassMethods() { if (!isset($_methods)) { $methods = $this->_getClassMethods(); foreach ($methods as $method) { $_methods[] = $method->getName(); } } return $_properties; } public... getClassProperties() { if (!isset($_properties)) { 19 CHAPTER 2 ■ FOUNDATION $properties = $this->_getClassProperties(); foreach ($properties as $property) { $_properties[] = $property->getName(); } } return $_properties; } public function getClassMethods() { if (!isset($_methods)) { $methods = $this->_getClassMethods(); foreach ($methods as $method) { $_methods[] = $method->getName(); } } return $_properties;... { protected $_class; protected $_meta = array( "class" => array(), "properties" => array(), "methods" => array() ); protected $_properties = array(); protected $_methods = array(); public function construct($class) { $this->_class = $class; } protected function _getClassComment() { $reflection = new \ReflectionClass($this->_class); return $reflection->getDocComment(); } protected function _getClassProperties()... { protected $_class; protected $_meta = array( "class" => array(), "properties" => array(), "methods" => array() ); protected $_properties = array(); protected $_methods = array(); public function construct($class) { $this->_class = $class; } protected function _getClassComment() { $reflection = new \ReflectionClass($this->_class); return $reflection->getDocComment(); } protected function _getClassProperties()... \ReflectionClass($this->_class); return $reflection->getProperties(); } protected function _getClassMethods() { $reflection = new \ReflectionClass($this->_class); return $reflection->getMethods(); } protected function _getPropertyComment($property) { $reflection = new \ReflectionProperty($this->_class, $property); return $reflection->getDocComment(); } This book was purchased by oxycoder@yahoo.com protected function _getMethodComment($method)... \ReflectionClass($this->_class); return $reflection->getProperties(); } protected function _getClassMethods() { $reflection = new \ReflectionClass($this->_class); return $reflection->getMethods(); 21 CHAPTER 2 ■ FOUNDATION } protected function _getPropertyComment($property) { $reflection = new \ReflectionProperty($this->_class, $property); return $reflection->getDocComment(); } protected function _getMethodComment($method)... Perhaps we could want to enforce read-only/write-only/read-write behavior on class properties The $_view property is protected, so it is not accessible outside the class, but imagine we have getters/setters for our class’s protected properties We could, in those getters/setters, read the Doc Comments of our protected properties and enforce behavior based on them Perhaps we could want to make sure a . ese are not the best or the only PHP MVC
frameworks, but simply a good cross-section of the dierent approaches to PHP MVC development.
CodeIgniter
CodeIgniter. won’t teach you PHP. It assumes you have basic knowledge of PHP and are at least comfortable with
building PHP web sites. If you are new to PHP or have never