<?php
namespace SabaiApps\Directories\Component\Display\Icon;

use SabaiApps\Directories\Application;
use SabaiApps\Directories\Component\Display\Model\Display;
use SabaiApps\Directories\Component\Entity\Model\Bundle;

abstract class AbstractIcon implements IIcon {

	protected $_application, $_name, $_info;

	public function __construct( Application $application, $name ) {
		$this->_application = $application;
		$this->_name        = $name;
	}

	public function displayIconInfo( Bundle $bundle, $key = null ) {
		if ( ! isset( $this->_info ) ) {
			$this->_info = (array) $this->_displayIconInfo( $bundle );
		}

		return isset( $key ) ? ( isset( $this->_info[ $key ] ) ? $this->_info[ $key ] : null ) : $this->_info;
	}

	public function displayIconSupports( Bundle $bundle, Display $display ) {
		return true; }

	public function displayIconSettingsForm( Bundle $bundle, array $settings, Display $display, array $parents = array() ) {}

	abstract protected function _displayIconInfo( Bundle $bundle );
}
