Skip to content

Instantly share code, notes, and snippets.

@mjrider
Created March 15, 2016 14:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mjrider/880ee40feba6dfd42f55 to your computer and use it in GitHub Desktop.
Save mjrider/880ee40feba6dfd42f55 to your computer and use it in GitHub Desktop.
<?php
interface ar_core_templateStoreInterface {
public function __construct($options);
// save template in store
public function save( $path, $template, $name, $type = "pobject", $nls = "any");
// retrieve a template defined by a previous save
public function get( $path, $name, $type, $nls );
// does an template exists, mainly for fast checking
public function exists( $path, $name, $type, $nls );
// return a list of templates defined
// returns a array structure
// return [ $name ] [ $type ] [ $nls ]
public function list();
// return a closure
public function import( $path, $name, $type, $nls);
}
class ar_core_templateFilestore implements ar_core_templateStoreInterface {
private $filestore = null;
private $cache = [];
const $templateFileName = "%s.%s.%s.pinp";
public function __construct($options){
$this->filestore = $options['filestore'];
}
// save template in store
public function save( $template, $name, $type = "pobject", $nls = "any"){
$filename = sprintf(self::$templateFileName,$type,$name,$nls);
// FIXME save in filestore
}
// retrieve a closure defined by a previous save
public function get( $template, $type, $nls );
// does an template exists, mainly for
public function exists( $template, $type, $nls );
// return a list of templates defined
public function list();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment