Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

50 lines (38 sloc) 0.81 kb
<?php
namespace FOQ\TyperBundle;
/**
* Writes a class header
*/
class HeaderTyper
{
/**
* @var string
*/
protected $namespace = null;
/**
* @var array
*/
protected $uses = 'array()';
/**
* @param string namespace
* @param array uses
*/
public function __construct($namespace, array $uses)
{
$this->namespace = $namespace;
$this->uses = $uses;
}
public function write()
{
$loc = array('<?php', '');
if ($this->namespace) {
$loc[] = sprintf('namespace %s;', $this->namespace);
$loc[] = '';
}
foreach ($this->uses as $use) {
$loc[] = sprintf('use %s;', $use);
}
$header = implode("\n", $loc);
return $header;
}
}
Jump to Line
Something went wrong with that request. Please try again.