http://phing.info/

Source Code Coverage

Designed for use with PHPUnit2, Xdebug and Phing.

Methods: 3 LOC: 76 Statements: 6

Source file Statements Methods Total coverage
Acl.php 100.0% 100.0% 100.0%
 
1
<?php
2
/**
3
 * Xyster Framework
4
 *
5
 * LICENSE
6
 *
7
 * This source file is subject to the new BSD license that is bundled
8
 * with this package in the file LICENSE.txt.
9
 * It is also available through the world-wide-web at this URL:
10
 * http://www.opensource.org/licenses/bsd-license.php
11
 * If you did not receive a copy of the license and are unable to
12
 * obtain it through the world-wide-web, please send an email
13
 * to xyster@devweblog.org so we can send you a copy immediately.
14
 *
15
 * @category  Xyster
16
 * @package   Xyster_Orm
17
 * @subpackage Plugins
18
 * @copyright Copyright (c) 2007 Irrational Logic (http://devweblog.org)
19
 * @license   http://www.opensource.org/licenses/bsd-license.php New BSD License
20
 * @version   $Id: Acl.php 117 2007-10-07 23:04:03Z doublecompile $
21
 */
22
/**
23
 * @see Xyster_Orm_Plugin_Abstract
24
 */
25 1
require_once 'Xyster/Orm/Plugin/Abstract.php';
26
/**
27
 * The base ORM plugin object
28
 *
29
 * @category  Xyster
30
 * @package   Xyster_Orm
31
 * @subpackage Plugins
32
 * @copyright Copyright (c) 2007 Irrational Logic (http://devweblog.org)
33
 * @license   http://www.opensource.org/licenses/bsd-license.php New BSD License
34
 */
35
class Xyster_Orm_Plugin_Acl extends Xyster_Orm_Plugin_Abstract
36
{
37
    /**
38
     * The access control list
39
     *
40
     * @var Zend_Acl
41
     */
42
    protected $_acl;
43
44
    /**
45
     * Creates a new ACL plugin
46
     *
47
     * @param Zend_Acl $acl
48
     */
49
    public function __construct( Zend_Acl $acl )
50
    {
51 2
        $this->_acl = $acl;
52
    }
53
54
    /**
55
     * Gets the access control list
56
     *
57
     * @return Zend_Acl
58
     */
59
    public function getAcl()
60
    {
61 1
        return $this->_acl;
62
    }
63
64
    /**
65
     * Loads an entity into the ACL if it's a {@link Zend_Acl_Resource_Interface}
66
     *
67
     * @param Xyster_Orm_Entity $entity
68
     */
69
    public function postLoad( Xyster_Orm_Entity $entity )
70
    {
71
        if ( $entity instanceof Zend_Acl_Resource_Interface
72 1
            && !$this->_acl->has($entity) ) {
73 1
            $this->_acl->add($entity);
74 1
        }
75
    }
76
}


Report generated at 2007-10-08T19:32:23-05:00