Config object is responsible for storing all the configuration used to setup a connection to the database, as well as a few helpers.
Author: Robert Crowe (hello@vivalacrowe.com)
Example #1
0
 function testCreateEnvironmentWithCompressors()
 {
     $config = new Config(array('js_compressor' => 'uglify_js', 'css_compressor' => 'yuglify_css'));
     $env = $config->createEnvironment();
     $this->assertTrue($env->bundleProcessors->isRegistered($env->contentType('.js'), $env->compressors['uglify_js']));
     $this->assertTrue($env->bundleProcessors->isRegistered($env->contentType('.css'), $env->compressors['yuglify_css']));
 }
Example #2
0
 private function __construct()
 {
     $this->config = Config::instance();
 }
Example #3
0
 /**
  * Table constructor. Returns instance of Pipe\Table to query against. If the table does not
  * exist a PDOException is thrown.
  *
  * @param  string $name Name of table
  * @throws PDOException
  * @throws PipeException
  * @return Pipe\Table
  */
 public function __construct($name)
 {
     if (!is_string($name) || strlen($name) === 0) {
         throw new PipeException("Invalid table name specified");
     }
     $this->table = $name;
     $this->config = Config::instance();
     $this->connection = Connection::instance()->pdo;
     $this->sql = new SQL($name);
     //Check table exists
     //Do this trying to get column details
     $this->columns = $this->columns();
     //Make sure table has an `ID` field, Pipe needs this to work
     if (!in_array('id', $this->columns)) {
         throw new PipeException("Table `{$name}` must contain an `id` column");
     }
 }