PageRenderTime 217ms CodeModel.GetById 115ms app.highlight 5ms RepoModel.GetById 92ms app.codeStats 0ms

/library/Zend/Log/Writer/Mock.php

https://bitbucket.org/hieronim1981/tunethemusic
PHP | 81 lines | 19 code | 6 blank | 56 comment | 0 complexity | 0d4e9d978b2908f2c15f415ff49e92d1 MD5 | raw file
 1<?php
 2/**
 3 * Zend 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://framework.zend.com/license/new-bsd
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 license@zend.com so we can send you a copy immediately.
14 *
15 * @category   Zend
16 * @package    Zend_Log
17 * @subpackage Writer
18 * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19 * @license    http://framework.zend.com/license/new-bsd     New BSD License
20 * @version    $Id: Mock.php 24593 2012-01-05 20:35:02Z matthew $
21 */
22
23/** Zend_Log_Writer_Abstract */
24require_once 'Zend/Log/Writer/Abstract.php';
25
26/**
27 * @category   Zend
28 * @package    Zend_Log
29 * @subpackage Writer
30 * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
31 * @license    http://framework.zend.com/license/new-bsd     New BSD License
32 * @version    $Id: Mock.php 24593 2012-01-05 20:35:02Z matthew $
33 */
34class Zend_Log_Writer_Mock extends Zend_Log_Writer_Abstract
35{
36    /**
37     * array of log events
38     *
39     * @var array
40     */
41    public $events = array();
42
43    /**
44     * shutdown called?
45     *
46     * @var boolean
47     */
48    public $shutdown = false;
49
50    /**
51     * Write a message to the log.
52     *
53     * @param  array  $event  event data
54     * @return void
55     */
56    public function _write($event)
57    {
58        $this->events[] = $event;
59    }
60
61    /**
62     * Record shutdown
63     *
64     * @return void
65     */
66    public function shutdown()
67    {
68        $this->shutdown = true;
69    }
70
71    /**
72     * Create a new instance of Zend_Log_Writer_Mock
73     *
74     * @param  array|Zend_Config $config
75     * @return Zend_Log_Writer_Mock
76     */
77    static public function factory($config)
78    {
79        return new self();
80    }
81}