13 * to license@zend.com so we can send you a copy immediately. |
13 * to license@zend.com so we can send you a copy immediately. |
14 * |
14 * |
15 * @category Zend |
15 * @category Zend |
16 * @package Zend_Application |
16 * @package Zend_Application |
17 * @subpackage Bootstrap |
17 * @subpackage Bootstrap |
18 * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) |
18 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) |
19 * @license http://framework.zend.com/license/new-bsd New BSD License |
19 * @license http://framework.zend.com/license/new-bsd New BSD License |
20 * @version $Id: BootstrapAbstract.php 24593 2012-01-05 20:35:02Z matthew $ |
20 * @version $Id$ |
21 */ |
21 */ |
|
22 |
|
23 /** |
|
24 * @see Zend_Application_Bootstrap_Bootstrapper |
|
25 */ |
|
26 require_once 'Zend/Application/Bootstrap/Bootstrapper.php'; |
|
27 |
|
28 /** |
|
29 * @see Zend_Application_Bootstrap_ResourceBootstrapper |
|
30 */ |
|
31 require_once 'Zend/Application/Bootstrap/ResourceBootstrapper.php'; |
22 |
32 |
23 /** |
33 /** |
24 * Abstract base class for bootstrap classes |
34 * Abstract base class for bootstrap classes |
25 * |
35 * |
26 * @uses Zend_Application_Bootstrap_Bootstrapper |
36 * @uses Zend_Application_Bootstrap_Bootstrapper |
27 * @uses Zend_Application_Bootstrap_ResourceBootstrapper |
37 * @uses Zend_Application_Bootstrap_ResourceBootstrapper |
28 * @category Zend |
38 * @category Zend |
29 * @package Zend_Application |
39 * @package Zend_Application |
30 * @subpackage Bootstrap |
40 * @subpackage Bootstrap |
31 * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) |
41 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) |
32 * @license http://framework.zend.com/license/new-bsd New BSD License |
42 * @license http://framework.zend.com/license/new-bsd New BSD License |
33 */ |
43 */ |
34 abstract class Zend_Application_Bootstrap_BootstrapAbstract |
44 abstract class Zend_Application_Bootstrap_BootstrapAbstract |
35 implements Zend_Application_Bootstrap_Bootstrapper, |
45 implements Zend_Application_Bootstrap_Bootstrapper, |
36 Zend_Application_Bootstrap_ResourceBootstrapper |
46 Zend_Application_Bootstrap_ResourceBootstrapper |
92 * |
102 * |
93 * Sets application object, initializes options, and prepares list of |
103 * Sets application object, initializes options, and prepares list of |
94 * initializer methods. |
104 * initializer methods. |
95 * |
105 * |
96 * @param Zend_Application|Zend_Application_Bootstrap_Bootstrapper $application |
106 * @param Zend_Application|Zend_Application_Bootstrap_Bootstrapper $application |
97 * @return void |
|
98 * @throws Zend_Application_Bootstrap_Exception When invalid application is provided |
107 * @throws Zend_Application_Bootstrap_Exception When invalid application is provided |
99 */ |
108 */ |
100 public function __construct($application) |
109 public function __construct($application) |
101 { |
110 { |
102 $this->setApplication($application); |
111 $this->setApplication($application); |
315 } |
324 } |
316 |
325 |
317 /** |
326 /** |
318 * Get a registered plugin resource |
327 * Get a registered plugin resource |
319 * |
328 * |
320 * @param string $resourceName |
329 * @param string $resource |
321 * @return Zend_Application_Resource_Resource |
330 * @return Zend_Application_Resource_Resource |
|
331 * @throws Zend_Application_Bootstrap_Exception |
322 */ |
332 */ |
323 public function getPluginResource($resource) |
333 public function getPluginResource($resource) |
324 { |
334 { |
325 if (array_key_exists(strtolower($resource), $this->_pluginResources)) { |
335 if (array_key_exists(strtolower($resource), $this->_pluginResources)) { |
326 $resource = strtolower($resource); |
336 $resource = strtolower($resource); |
429 /** |
439 /** |
430 * Set application/parent bootstrap |
440 * Set application/parent bootstrap |
431 * |
441 * |
432 * @param Zend_Application|Zend_Application_Bootstrap_Bootstrapper $application |
442 * @param Zend_Application|Zend_Application_Bootstrap_Bootstrapper $application |
433 * @return Zend_Application_Bootstrap_BootstrapAbstract |
443 * @return Zend_Application_Bootstrap_BootstrapAbstract |
|
444 * @throws Zend_Application_Bootstrap_Exception |
434 */ |
445 */ |
435 public function setApplication($application) |
446 public function setApplication($application) |
436 { |
447 { |
437 if (($application instanceof Zend_Application) |
448 if (($application instanceof Zend_Application) |
438 || ($application instanceof Zend_Application_Bootstrap_Bootstrapper) |
449 || ($application instanceof Zend_Application_Bootstrap_Bootstrapper) |
479 * |
490 * |
480 * Containers must be objects, and must allow setting public properties. |
491 * Containers must be objects, and must allow setting public properties. |
481 * |
492 * |
482 * @param object $container |
493 * @param object $container |
483 * @return Zend_Application_Bootstrap_BootstrapAbstract |
494 * @return Zend_Application_Bootstrap_BootstrapAbstract |
|
495 * @throws Zend_Application_Bootstrap_Exception |
484 */ |
496 */ |
485 public function setContainer($container) |
497 public function setContainer($container) |
486 { |
498 { |
487 if (!is_object($container)) { |
499 if (!is_object($container)) { |
488 throw new Zend_Application_Bootstrap_Exception('Resource containers must be objects'); |
500 throw new Zend_Application_Bootstrap_Exception('Resource containers must be objects'); |
555 return $this->getResource($prop); |
567 return $this->getResource($prop); |
556 } |
568 } |
557 |
569 |
558 /** |
570 /** |
559 * Implement PHP's magic to ask for the |
571 * Implement PHP's magic to ask for the |
560 * existence of a ressource in the bootstrap |
572 * existence of a resource in the bootstrap |
561 * |
573 * |
562 * @param string $prop |
574 * @param string $prop |
563 * @return bool |
575 * @return bool |
564 */ |
576 */ |
565 public function __isset($prop) |
577 public function __isset($prop) |
590 /** |
602 /** |
591 * Overloading: intercept calls to bootstrap<resourcename>() methods |
603 * Overloading: intercept calls to bootstrap<resourcename>() methods |
592 * |
604 * |
593 * @param string $method |
605 * @param string $method |
594 * @param array $args |
606 * @param array $args |
595 * @return void |
607 * @return Zend_Application_Bootstrap_BootstrapAbstract |
596 * @throws Zend_Application_Bootstrap_Exception On invalid method name |
608 * @throws Zend_Application_Bootstrap_Exception On invalid method name |
597 */ |
609 */ |
598 public function __call($method, $args) |
610 public function __call($method, $args) |
599 { |
611 { |
600 if (9 < strlen($method) && 'bootstrap' === substr($method, 0, 9)) { |
612 if (9 < strlen($method) && 'bootstrap' === substr($method, 0, 9)) { |