Exemplo n.º 1
0
 public function setUp()
 {
     Ledger::set('templates.path', __DIR__ . '/files');
     Ledger::set('templates.cache', __DIR__ . '/files/.cache');
     Ledger::set('templates.compile', __DIR__ . '/files/.cache');
     Ledger::set('templates.config', __DIR__ . '/files/.cache');
 }
Exemplo n.º 2
0
 /**
  * Set reader defaults.
  */
 protected function setDefaults()
 {
     $this->setDelimiter(Ledger::get('csv.delimiter'));
     $this->setLineEnding(Ledger::get('csv.line_ending'));
     $this->setEnclosure(Ledger::get('csv.enclosure'));
     $this->setEncoding(Ledger::get('csv.encoding'));
 }
Exemplo n.º 3
0
 /**
  * Construct.
  */
 public function __construct()
 {
     $this->smarty = new Smarty();
     $this->smarty->setTemplateDir(Ledger::get('templates.path'));
     $this->smarty->setCompileDir(Ledger::get('templates.compile'));
     $this->smarty->setCacheDir(Ledger::get('templates.cache'));
     $this->smarty->setConfigDir(Ledger::get('templates.config'));
 }
Exemplo n.º 4
0
 /**
  * Make the view.
  *
  * @param string $file
  * @param array  $data
  *
  * @return $this
  */
 public function make($file, array $data = [])
 {
     // Find the template file
     $finder = new FileFinder(Ledger::get('templates.path'), $this->extension);
     // Compile the template with the PhpEngine
     $this->results = (new PhpEngine($finder))->compile($file, $data);
     return $this;
 }
Exemplo n.º 5
0
 /**
  * @param         $title
  * @param Closure $callback
  * @param Snappy  $driver
  */
 public function __construct($title, Closure $callback = null, Snappy $driver = null)
 {
     // Set Snappy instance
     $this->driver = $driver ?: new Snappy(Ledger::get('pdf.snappy.binary'), Ledger::get('pdf.snappy.options', []));
     if ($timeout = Ledger::get('pdf.snappy.timeout', false)) {
         $this->driver->setTimeout($timeout);
     }
     parent::__construct($title, $callback);
 }
Exemplo n.º 6
0
 /**
  * Resolve the factory.
  *
  * @return mixed
  */
 protected function resolveFactory()
 {
     // Mostly when using the blade factory Laravel is used,
     // so we can try to get the Laravel View factory from the ioC container
     if (function_exists('app') && method_exists(app(), 'bound') && app()->bound('view')) {
         return app('view');
     }
     // Resolve the View factor
     return (new BladeEngine(Ledger::get('templates.path'), Ledger::get('templates.cache')))->getFactory();
 }
Exemplo n.º 7
0
 public function test_identify_based_on_default()
 {
     $this->assertEquals('php', (new EngineResolver('excel'))->getEngine());
     Ledger::set('templates.default', 'blade');
     $this->assertEquals('blade', (new EngineResolver('excel'))->getEngine());
 }
Exemplo n.º 8
0
 public function test_default_has()
 {
     $this->assertTrue(Ledger::has('drivers.reader.excel2003'));
     $this->assertFalse(Ledger::has('not-found'));
 }
Exemplo n.º 9
0
 /**
  * Get the driver.
  *
  * @param $type
  *
  * @return mixed
  */
 protected function getDriver($type)
 {
     return Ledger::resolve('drivers.' . $type . '.excel2007', 'PHPExcel');
 }
Exemplo n.º 10
0
 /**
  * Get the driver.
  *
  * @param $type
  *
  * @return mixed
  */
 protected function getDriver($type)
 {
     return Ledger::resolve('drivers.' . $type . '.pdf', 'Snappy');
 }
Exemplo n.º 11
0
 /**
  * @return array
  */
 protected function getEngines()
 {
     return Ledger::get('templates.engines', $this->engines);
 }
Exemplo n.º 12
0
 public function setUp()
 {
     Ledger::set('templates.path', __DIR__ . '/files');
 }
Exemplo n.º 13
0
 /**
  * Constructor.
  */
 public function __construct()
 {
     $loader = new Twig_Loader_Filesystem(Ledger::get('templates.path'));
     $this->twig = new Twig_Environment($loader, ['cache' => Ledger::get('templates.cache')]);
 }
Exemplo n.º 14
0
 /**
  * Get the driver.
  *
  * @param $type
  *
  * @return mixed
  */
 protected function getDriver($type)
 {
     return Ledger::resolve('drivers.' . $type . '.csv', 'LeagueCsv');
 }
Exemplo n.º 15
0
 /**
  * Get the driver.
  *
  * @param $type
  *
  * @return mixed
  */
 protected function getDriver($type)
 {
     return Ledger::resolve('drivers.' . $type . '.word2003', 'PHPWord');
 }
Exemplo n.º 16
0
 public function test_render_a_template()
 {
     $engine = new BladeEngine(Ledger::get('templates.path'), Ledger::get('templates.cache'));
     $this->assertInstanceOf('Illuminate\\Contracts\\View\\Factory', $engine->getFactory());
 }