<?php
/**
 * Zend Framework (http://framework.zend.com/)
 *
 * @link      http://github.com/zendframework/zf2 for the canonical source repository
 * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
 * @license   http://framework.zend.com/license/new-bsd New BSD License
 */

namespace Zend\ModuleManager\Listener;

/**
 * Abstract listener
 */
abstract class AbstractListener
{
    
/**
     * @var ListenerOptions
     */
    
protected $options;

    
/**
     * __construct
     *
     * @param  ListenerOptions $options
     */
    
public function __construct(ListenerOptions $options null)
    {
        if (
null === $options) {
            
$this->setOptions(new ListenerOptions);
        } else {
            
$this->setOptions($options);
        }
    }

    
/**
     * Get options.
     *
     * @return ListenerOptions
     */
    
public function getOptions()
    {
        return 
$this->options;
    }

    
/**
     * Set options.
     *
     * @param ListenerOptions $options the value to be set
     * @return AbstractListener
     */
    
public function setOptions(ListenerOptions $options)
    {
        
$this->options $options;
        return 
$this;
    }

    
/**
     * Write a simple array of scalars to a file
     *
     * @param  string $filePath
     * @param  array $array
     * @return AbstractListener
     */
    
protected function writeArrayToFile($filePath$array)
    {
        
$content "<?php\nreturn " var_export($array1) . ';';
        
file_put_contents($filePath$content);
        return 
$this;
    }
}