/** * 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; }
/** * 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(); } }
/** * */ 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')); }