Beispiel #1
0
 /**
  * Tests for the namespaceRoot() function.
  *
  * @return void
  */
 public function testNamespaceRoot()
 {
     // No namespace
     $this->assertEquals(null, namespaceRoot('Foo'));
     // A namespace
     $this->assertEquals('Foo', namespaceRoot('Foo\\Bar\\Baz'));
 }
 /**
  * Return the cache key name for the current table, language and domain.
  *
  * @return string
  */
 protected function cacheKey()
 {
     if ($this->cacheKey === null) {
         $plugin = Inflector::underscore(namespaceRoot(__CLASS__));
         $class = Inflector::underscore(namespaceTail(__CLASS__));
         $connection = Inflector::underscore($this->_table->connection()->configName());
         $table = Inflector::underscore($this->_table->table());
         $this->cacheKey = $plugin . '_' . $class . '_' . $connection . '_' . $table;
     }
     return $this->cacheKey;
 }
 /**
  * Return the cache key name for the current table, language and domain.
  *
  * @return string
  */
 protected function cacheKey()
 {
     if ($this->cacheKey === null) {
         $plugin = Inflector::underscore(namespaceRoot(__CLASS__));
         $class = Inflector::underscore(namespaceTail(__CLASS__));
         $connection = Inflector::underscore($this->_table->connection()->configName());
         $table = Inflector::underscore($this->_table->table());
         $lang = strtolower(ini_get('intl.default_locale'));
         $domain = $this->config('domain');
         $this->cacheKey = $plugin . '_' . $class . '_' . $connection . '_' . $table . '_' . $lang . '_' . $domain;
     }
     return $this->cacheKey;
 }