Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > it.comp.www.php > #20698

Re: trait per decoratore standard

From alex <1j9448a02@lnx159sneakemail.com.invalid>
Newsgroups it.comp.www.php
Subject Re: trait per decoratore standard
Date 2016-04-23 11:07 +0200
Organization Aioe.org NNTP Server
Message-ID <nffe1g$265$1@gioia.aioe.org> (permalink)
References (4 earlier) <nfdck8$156e$1@gioia.aioe.org> <dnv4k9FrdduU1@mid.individual.net> <nfe0uj$9e3$1@gioia.aioe.org> <dnvgthFtcr9U2@mid.individual.net> <nffbqp$1u9k$1@gioia.aioe.org>

Show all headers | View raw


Il 23/04/2016 10:30, alex ha scritto:
>
> interface LoggerInterface
> {
>   function get($key);
> }
>
> class Log implements LoggerInterface
> {
>   private $logs = [];
>
>   // todo: questa funzione sarebbe meglio chiamarla add
>   final function set($log)
>   {
>     $this->logs[] = $log; // aggiunge un logger
>   }
>
>   function get($key) { return $this->logs[$key]; }
> }
>
> class HtmlLog extends Log
> {
>    function get($key) {
>      return '<ul><li>'.
>        implode('<\li><li>', parent::get($key)).
>        '<\li><\ul>';
>    }
> }
>
>

Ancora meglio

class Logs
{
	private $logs = [];

	final function add($log)
	{
		$this->logs[] = $log;
	}
	
	final function get($key) {
		return $this->logs[$key];
	}
}

class HtmlLog
{
	private $wrapped;
	
	function __construct($wrapped)
	{
		$this->wrapped=
				'<ul><li>'.
				$wrapped.
				'<\li><\ul>'
		;
	}
	
	function __toString()
	{
		return $this->wrapped;
	}
}

$logs = new Logs();
$log->add(new HtmlLog(123));

Back to it.comp.www.php | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

trait per decoratore standard alex <1j9448a02@lnx159sneakemail.com.invalid> - 2016-04-22 11:10 +0200
  Re: trait per decoratore standard Alessandro Pellizzari <shuriken@amiran.it> - 2016-04-22 10:36 +0100
    Re: trait per decoratore standard alex <1j9448a02@lnx159sneakemail.com.invalid> - 2016-04-22 12:08 +0200
      Re: trait per decoratore standard Alessandro Pellizzari <shuriken@amiran.it> - 2016-04-22 14:39 +0100
        Re: trait per decoratore standard alex <1j9448a02@lnx159sneakemail.com.invalid> - 2016-04-22 16:31 +0200
          Re: trait per decoratore standard Alessandro Pellizzari <shuriken@amiran.it> - 2016-04-22 18:16 +0100
            Re: trait per decoratore standard fmassei@gmail.com - 2016-04-22 10:58 -0700
              Re: trait per decoratore standard Alessandro Pellizzari <shuriken@amiran.it> - 2016-04-22 20:00 +0000
                Re: trait per decoratore standard fmassei@gmail.com - 2016-04-22 14:01 -0700
                Re: trait per decoratore standard Alessandro Pellizzari <shuriken@amiran.it> - 2016-04-23 17:56 +0000
                Re: trait per decoratore standard fmassei@gmail.com - 2016-04-24 22:16 -0700
                Re: trait per decoratore standard Alessandro Pellizzari <shuriken@amiran.it> - 2016-04-25 14:10 +0100
              Re: trait per decoratore standard alex <1j9448a02@lnx159sneakemail.com.invalid> - 2016-04-22 22:26 +0200
            Re: trait per decoratore standard alex <1j9448a02@lnx159sneakemail.com.invalid> - 2016-04-22 22:18 +0200
              Re: trait per decoratore standard Alessandro Pellizzari <shuriken@amiran.it> - 2016-04-22 20:46 +0000
                Re: trait per decoratore standard alex <1j9448a02@lnx159sneakemail.com.invalid> - 2016-04-23 10:30 +0200
                Re: trait per decoratore standard alex <1j9448a02@lnx159sneakemail.com.invalid> - 2016-04-23 11:07 +0200
                Re: trait per decoratore standard alex <1j9448a02@lnx159sneakemail.com.invalid> - 2016-04-23 11:32 +0200
                Re: trait per decoratore standard Alessandro Pellizzari <shuriken@amiran.it> - 2016-04-23 17:50 +0000
                Re: trait per decoratore standard alex <1j9448a02@lnx159sneakemail.com.invalid> - 2016-04-24 10:36 +0200
                Re: trait per decoratore standard alex <1j9448a02@lnx159sneakemail.com.invalid> - 2016-04-24 10:50 +0200
                Re: trait per decoratore standard Alessandro Pellizzari <shuriken@amiran.it> - 2016-04-24 11:28 +0000
                Re: trait per decoratore standard alex <1j9448a02@lnx159sneakemail.com.invalid> - 2016-04-24 18:48 +0200
                Re: trait per decoratore standard fmassei@gmail.com - 2016-04-24 22:19 -0700
                Re: trait per decoratore standard Alessandro Pellizzari <shuriken@amiran.it> - 2016-04-23 17:45 +0000
                Re: trait per decoratore standard alex <1j9448a02@lnx159sneakemail.com.invalid> - 2016-04-24 10:26 +0200
                Re: trait per decoratore standard Alessandro Pellizzari <shuriken@amiran.it> - 2016-04-24 11:26 +0000
                Re: trait per decoratore standard alex <1j9448a02@lnx159sneakemail.com.invalid> - 2016-04-26 14:50 +0200
                Re: trait per decoratore standard Alessandro Pellizzari <shuriken@amiran.it> - 2016-04-26 15:07 +0100
                Re: trait per decoratore standard alex <1j9448a02@lnx159sneakemail.com.invalid> - 2016-04-26 21:11 +0200
                Re: trait per decoratore standard Alessandro Pellizzari <shuriken@amiran.it> - 2016-04-26 19:31 +0000
                Re: trait per decoratore standard alex <1j9448a02@lnx159sneakemail.com.invalid> - 2016-04-26 22:02 +0200
                Re: trait per decoratore standard Alessandro Pellizzari <shuriken@amiran.it> - 2016-04-26 20:39 +0000
                Re: trait per decoratore standard alex <1j9448a02@lnx159sneakemail.com.invalid> - 2016-04-27 16:10 +0200
                Re: trait per decoratore standard Alessandro Pellizzari <shuriken@amiran.it> - 2016-04-27 15:16 +0100
                Re: trait per decoratore standard alex <1j9448a02@lnx159sneakemail.com.invalid> - 2016-04-27 17:26 +0200
                Re: trait per decoratore standard alex <1j9448a02@lnx159sneakemail.com.invalid> - 2016-04-29 17:42 +0200
                Re: trait per decoratore standard Alessandro Pellizzari <shuriken@amiran.it> - 2016-04-29 17:12 +0100
                Re: trait per decoratore standard alex <1j9448a02@lnx159sneakemail.com.invalid> - 2016-04-30 13:20 +0200
                Re: trait per decoratore standard fmassei@gmail.com - 2016-04-30 08:06 -0700
                Re: trait per decoratore standard alex <1j9448a02@lnx159sneakemail.com.invalid> - 2016-04-30 21:26 +0200
                Re: trait per decoratore standard Alessandro Pellizzari <shuriken@amiran.it> - 2016-04-30 19:42 +0000
                Re: trait per decoratore standard alex <1j9448a02@lnx159sneakemail.com.invalid> - 2016-04-30 23:20 +0200
                Re: trait per decoratore standard Alessandro Pellizzari <shuriken@amiran.it> - 2016-04-30 21:43 +0000
                Re: trait per decoratore standard alex <1j9448a02@lnx159sneakemail.com.invalid> - 2016-05-01 10:34 +0200
                Re: trait per decoratore standard fmassei@gmail.com - 2016-04-30 14:38 -0700
                Re: trait per decoratore standard Alessandro Pellizzari <shuriken@amiran.it> - 2016-04-30 21:41 +0000
                Re: trait per decoratore standard alex <1j9448a02@lnx159sneakemail.com.invalid> - 2016-05-01 10:45 +0200
                Re: trait per decoratore standard fmassei@gmail.com - 2016-05-01 09:02 -0700
                Re: trait per decoratore standard alex <1j9448a02@lnx159sneakemail.com.invalid> - 2016-05-02 10:45 +0200
      Re: trait per decoratore standard fmassei@gmail.com - 2016-04-22 07:12 -0700
        Re: trait per decoratore standard alex <1j9448a02@lnx159sneakemail.com.invalid> - 2016-04-22 16:44 +0200
          Re: trait per decoratore standard fmassei@gmail.com - 2016-04-22 07:58 -0700

csiph-web