Esempio n. 1
0
 /**
  * Returns the table name of the model.
  *
  * @access  public
  * @return  string
  */
 public function getTable()
 {
     if (empty($this->tableName)) {
         $this->tableName = Str::pluralize(Str::camel2underscored($this->getClassShortName()));
     }
     return $this->tableName;
 }
Esempio n. 2
0
 /**
  * Sends command to Redis server and returns response.
  *
  * @access  public
  * @param   string  $name       Command name
  * @param   array   $arguments  Command arguments
  * @return  mixed
  */
 public function __call($name, $arguments)
 {
     // Build command
     $arguments = array_merge(explode(' ', strtoupper(str_replace('_', ' ', Str::camel2underscored($name)))), $arguments);
     $command = '*' . count($arguments) . static::CRLF;
     foreach ($arguments as $argument) {
         $command .= '$' . strlen($argument) . static::CRLF . $argument . static::CRLF;
     }
     if ($this->pipelined) {
         // Pipeline commands
         $this->commands[] = $command;
         return $this;
     } else {
         // Send command to server and return response
         $this->connection->write($command);
         return $this->response();
     }
 }
Esempio n. 3
0
 /**
  *
  */
 public function testCamel2underscored()
 {
     $this->assertEquals('hello_world', Str::camel2underscored('helloWorld'));
     $this->assertEquals('hello_world', Str::camel2underscored('HelloWorld'));
     $this->assertEquals('this_is_camel_case', Str::camel2underscored('thisIsCamelCase'));
     $this->assertEquals('this_is_camel_case', Str::camel2underscored('ThisIsCamelCase'));
 }