Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Tree: 80b19e82d4
Fetching contributors…

Cannot retrieve contributors at this time

123 lines (95 sloc) 1.892 kB
<?php
namespace mageekguy\atoum;
class report implements observer, adapter\aggregator
{
protected $title = null;
protected $factory = null;
protected $locale = null;
protected $adapter = null;
protected $writers = array();
protected $fields = array();
protected $lastSetFields = array();
public function __construct(factory $factory = null)
{
$this
->setFactory($factory ?: new factory())
->setLocale($this->factory['mageekguy\atoum\locale']())
->setAdapter($this->factory['mageekguy\atoum\adapter']())
;
}
public function setFactory(factory $factory)
{
$this->factory = $factory;
return $this;
}
public function getFactory()
{
return $this->factory;
}
public function setTitle($title)
{
$this->title = (string) $title;
return $this;
}
public function getTitle()
{
return $this->title;
}
public function setLocale(locale $locale)
{
$this->locale = $locale;
return $this;
}
public function getLocale()
{
return $this->locale;
}
public function setAdapter(adapter $adapter)
{
$this->adapter = $adapter;
return $this;
}
public function getAdapter()
{
return $this->adapter;
}
public function addField(report\field $field)
{
$this->fields[] = $field;
return $this;
}
public function getFields()
{
return $this->fields;
}
public function getWriters()
{
return $this->writers;
}
public function handleEvent($event, observable $observable)
{
$this->lastSetFields = array();
foreach ($this->fields as $field)
{
if ($field->handleEvent($event, $observable) === true)
{
$this->lastSetFields[] = $field;
}
}
return $this;
}
public function __toString()
{
$string = '';
foreach ($this->lastSetFields as $field)
{
$string .= $field;
}
return $string;
}
protected function doAddWriter($writer)
{
$this->writers[] = $writer;
return $this;
}
}
Jump to Line
Something went wrong with that request. Please try again.