diff --git a/README.mkd b/README.mkd index aae42cde..f0b8c0af 100644 --- a/README.mkd +++ b/README.mkd @@ -38,7 +38,7 @@ Inserting Querying -------- - $users->get('key'); + $users->get('key'); $users->multiget(array('key1', 'key2')); Removing diff --git a/columnfamily.php b/columnfamily.php index c6e2d8e1..4503b8fa 100644 --- a/columnfamily.php +++ b/columnfamily.php @@ -20,7 +20,7 @@ static public function import($bytes) { /** * Generate a v1 UUID (timestamp based) - * @return string a byte[] representation of a UUID + * @return string a byte[] representation of a UUID * @param string $node what to use for the MAC portion of the UUID. This will be generated * randomly if left as NULL * @param int $time timestamp to use for the UUID. This should be a number of microseconds @@ -33,7 +33,7 @@ static public function uuid1($node=null, $time=null) { /** * Generate a v3 UUID - * @return string a byte[] representation of a UUID + * @return string a byte[] representation of a UUID */ static public function uuid3($node=null, $namespace=null) { $uuid = UUID::mint(3, $node, $namespace); @@ -42,7 +42,7 @@ static public function uuid3($node=null, $namespace=null) { /** * Generate a v4 UUID - * @return string a byte[] representation of a UUID + * @return string a byte[] representation of a UUID */ static public function uuid4() { $uuid = UUID::mint(4); @@ -51,7 +51,7 @@ static public function uuid4() { /** * Generate a v5 UUID - * @return string a byte[] representation of a UUID + * @return string a byte[] representation of a UUID */ static public function uuid5($node, $namespace=null) { $uuid = UUID::mint(5, $node, $namespace); @@ -149,7 +149,7 @@ class ColumnFamily { * replaced by an array of the form array(column_value, column_timestamp). */ public $include_timestamp = false; - /** + /** * @var int When calling `get_range`, the intermediate results need * to be buffered if we are fetching many rows, otherwise the Cassandra * server will overallocate memory and fail. This is the size of @@ -162,7 +162,7 @@ class ColumnFamily { * * @param Connection $connection the connection to use for this ColumnFamily * @param string $column_family the name of the column family in Cassandra - * @param bool $autopack_names whether or not to automatically convert column names + * @param bool $autopack_names whether or not to automatically convert column names * to and from their binary representation in Cassandra * based on their comparator type * @param bool $autopack_values whether or not to automatically convert column values @@ -211,7 +211,7 @@ public function __construct($pool, $this->key_type = 'BytesType'; $this->col_type_dict = array(); - $this->is_super = $this->cfdef->column_type === 'Super'; + $this->is_super = $this->cfdef->column_type === 'Super'; $this->set_autopack_names($autopack_names); $this->set_autopack_values($autopack_values); $this->set_autopack_keys(true); @@ -627,7 +627,7 @@ public function insert($key, */ public function add($key, $column, $value=1, $super_column=null, $write_consistency_level=null) { - + $cp = $this->create_column_parent($super_column); $packed_key = $this->pack_key($key); $counter = new cassandra_CounterColumn(); @@ -707,7 +707,7 @@ public function remove($key, $columns=null, $super_column=null, $write_consisten $mutation = new cassandra_Mutation(); $mutation->deletion = $deletion; - $mut_map = array($packed_key => array($this->column_family => array($mutation))); + $mut_map = array($packed_key => array($this->column_family => array($mutation))); return $this->pool->call("batch_mutate", $mut_map, $this->wcl($write_consistency_level)); } @@ -767,7 +767,7 @@ private static function extract_type_name($type_string) { $index = strrpos($type_string, '.'); if ($index == false) return 'BytesType'; - + $type = substr($type_string, $index + 1); if (!isset(self::$TYPES[$type])) return 'BytesType'; @@ -871,8 +871,8 @@ public function unpack_key($b) { private function get_data_type_for_col($col_name) { if (isset($this->col_type_dict[$col_name])) return $this->col_type_dict[$col_name]; - else - return $this->cf_data_type; + else + return $this->cf_data_type; } private function pack_value($value, $col_name) { @@ -894,8 +894,8 @@ private static function unpack_str($str, $len) { if($v > 0) { $out_str .= chr($v); } return $out_str; } - - private static function pack_str($str, $len) { + + private static function pack_str($str, $len) { $out_str = ""; for($i=0; $i<$len; $i++) $out_str .= pack("c", ord(substr($str, $i, 1))); @@ -1013,7 +1013,7 @@ private function pack($value, $data_type) { else return $value; } - + private function unpack($value, $data_type) { if ($data_type == 'LongType') return self::unpack_long($value); @@ -1121,7 +1121,7 @@ private function array_to_mutation($array, $timestamp=null, $ttl=null) { } return $ret; } - + private function array_to_supercolumns_or_columns($array, $timestamp=null, $ttl=null) { if(empty($timestamp)) $timestamp = CassandraUtil::get_time(); @@ -1275,7 +1275,7 @@ public function next() { { # We've reached the end of this page, but there should be more # in the CF - + # Get the next buffer (next_start_key has already been set) $this->get_buffer(); diff --git a/debian/rules b/debian/rules index 1a8e1dc9..abea83c3 100755 --- a/debian/rules +++ b/debian/rules @@ -21,7 +21,7 @@ THRIFT_DETRITUS = \ build %: - dh $@ + dh $@ override_dh_auto_configure: cd $(THRIFTDIR) && phpize diff --git a/doc/index.rst b/doc/index.rst index 4f92051c..e224e6fe 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -53,7 +53,7 @@ About This Documentation ------------------------ This documentation is generated using the `Sphinx `_ documentation generator. The source files -for the documentation are located in the `doc/` directory of +for the documentation are located in the `doc/` directory of **phpcassa**. To generate the documentation, run the following command from the `doc` directory: diff --git a/doc/tutorial.rst b/doc/tutorial.rst index 8d7dab01..9897471e 100644 --- a/doc/tutorial.rst +++ b/doc/tutorial.rst @@ -17,7 +17,7 @@ should execute without raising an exception: This tutorial also assumes that a Cassandra instance is running on the default host and port. Read the `instructions for getting started -with Cassandra `_. +with Cassandra `_. You can start Cassandra like so: .. code-block:: bash @@ -37,7 +37,7 @@ for this tutorial: .. code-block:: none - user@~ $ cassandra-cli + user@~ $ cassandra-cli Welcome to cassandra CLI. Type 'help;' or '?' for help. Type 'quit;' or 'exit;' to quit. @@ -174,7 +174,7 @@ some rows with keys 'row_key1' through 'row_key9', we can do this: Print_r($columns); } -It's also possible to specify a set of columns or a slice for +It's also possible to specify a set of columns or a slice for `ColumnFamily::multiget() `_ and `ColumnFamily::get_range() `_, @@ -368,13 +368,13 @@ will be indexed. In a ``cassandra.yaml`` file, this might look like: validator_class: LongType index_type: KEYS -In order to use +In order to use `ColumnFamily::get_indexed_slices() `_ -to get data from Indexed1 using the indexed column, we need to create an +to get data from Indexed1 using the indexed column, we need to create an `IndexClause `_ which contains a list of `IndexExpression `_ -objects. The functions +objects. The functions `CassandraUtil::create_index_expression() `_ and `CassandraUtil::create_index_clause() `_ @@ -397,7 +397,7 @@ the following: Print_r($columns) } -Although at least one +Although at least one `IndexExpression `_ in every clause must be on an indexed column, you may also have other expressions which are on non-indexed columns. diff --git a/sysmanager.php b/sysmanager.php index f57b85b2..aafe5472 100644 --- a/sysmanager.php +++ b/sysmanager.php @@ -451,13 +451,13 @@ public function create_index($keyspace, $column_family, $column, * @param string $column the name of the column to drop the index from */ public function drop_index($keyspace, $column_family, $column) { - $matched = false; + $matched = false; $this->client->set_keyspace($keyspace); - $cfdef = $this->get_cfdef($keyspace, $column_family); + $cfdef = $this->get_cfdef($keyspace, $column_family); $col_metas = $cfdef->column_metadata; for ($i = 0; $i < count($col_metas); $i++) { - $col_meta = $col_metas[$i]; + $col_meta = $col_metas[$i]; if ($col_meta->name == $column) { $col_meta->index_type = NULL; $col_meta->index_name = NULL; @@ -474,7 +474,7 @@ public function drop_index($keyspace, $column_family, $column) { } /** - * Describes the Cassandra cluster. + * Describes the Cassandra cluster. * * @return array the node to token mapping */ diff --git a/test/test_autopacking.php b/test/test_autopacking.php index e10fd139..4ef1f00e 100644 --- a/test/test_autopacking.php +++ b/test/test_autopacking.php @@ -69,7 +69,7 @@ public function __construct() { $cfattrs["comparator_type"] = DataType::UTF8_TYPE; $this->sys->create_column_family(self::$KS, 'SuperUTF8', $cfattrs); - + $cfattrs = array("column_type" => "Super", "comparator_type" => DataType::LONG_TYPE); @@ -123,7 +123,7 @@ public function __construct() { // Quick way to create a TimeUUIDType validator to subcol $this->sys->create_index(self::$KS, 'DefaultValidator', 'subcol', DataType::TIME_UUID_TYPE, NULL, NULL); - + $this->client = new ConnectionPool(self::$KS); $this->cf_long = new ColumnFamily($this->client, 'StdLong'); $this->cf_int = new ColumnFamily($this->client, 'StdInteger'); @@ -308,7 +308,7 @@ public function test_standard_column_family() { $ascii_cols = array('aaaa', 'bbbb', 'cccc'); $type_groups[] = self::make_group($this->cf_ascii, $ascii_cols); - $utf8_cols = array("aЗ", "bИ", "cЙ"); + $utf8_cols = array("aЗ", "bИ", "cЙ"); $type_groups[] = self::make_group($this->cf_utf8, $utf8_cols); @@ -357,7 +357,7 @@ public function test_standard_column_family() { ### multiget() tests ### $result = $group['cf']->multiget(self::$KEYS); - foreach(range(0,2) as $i) + foreach(range(0,2) as $i) self::assertEqual($result[self::$KEYS[0]], $group['dict']); $result = $group['cf']->multiget(array(self::$KEYS[2])); @@ -442,7 +442,7 @@ public function test_super_column_families() { $ascii_cols = array('aaaa', 'bbbb', 'cccc'); $type_groups[] = self::make_super_group($this->cf_supascii, $ascii_cols); - $utf8_cols = array("aЗ", "bИ", "cЙ"); + $utf8_cols = array("aЗ", "bИ", "cЙ"); $type_groups[] = self::make_super_group($this->cf_suputf8, $utf8_cols); foreach($type_groups as $group) { @@ -490,7 +490,7 @@ public function test_super_column_families() { ### multiget() tests ### $result = $group['cf']->multiget(self::$KEYS); - foreach(range(0,2) as $i) + foreach(range(0,2) as $i) self::assertEqual($result[self::$KEYS[0]], $group['dict']); $result = $group['cf']->multiget(array(self::$KEYS[2])); @@ -577,7 +577,7 @@ public function test_super_column_family_subs() { $ascii_cols = array('aaaa', 'bbbb', 'cccc'); $type_groups[] = self::make_sub_group($this->cf_suplong_subascii, $ascii_cols); - $utf8_cols = array("aЗ", "bИ", "cЙ"); + $utf8_cols = array("aЗ", "bИ", "cЙ"); $type_groups[] = self::make_sub_group($this->cf_suplong_subutf8, $utf8_cols); @@ -611,7 +611,7 @@ public function test_super_column_family_subs() { ### multiget() tests ### $result = $group['cf']->multiget(self::$KEYS); - foreach(range(0,2) as $i) + foreach(range(0,2) as $i) self::assertEqual($result[self::$KEYS[0]], $group['dict']); $result = $group['cf']->multiget(array(self::$KEYS[2])); @@ -726,7 +726,7 @@ public function test_default_validated_columns() { public function test_uuid1_generation() { $micros = 1293769171436849; - $uuid = CassandraUtil::import(CassandraUtil::uuid1(null, $micros)); + $uuid = CassandraUtil::import(CassandraUtil::uuid1(null, $micros)); $t = (int)($uuid->time * 1000000); self::assertWithinMargin($micros, $t, 100); } diff --git a/test/test_columnfamily.php b/test/test_columnfamily.php index 611dbc51..d8440856 100644 --- a/test/test_columnfamily.php +++ b/test/test_columnfamily.php @@ -274,7 +274,7 @@ public function test_insert_get_range() { self::assertEqual($count, 201); - + # Row count above total number of rows, buffer_size = total number of rows $cf = new ColumnFamily($this->pool, 'Standard1', true, true, $read_consistency_level=$cl, $write_consistency_level=$cl, @@ -286,8 +286,8 @@ public function test_insert_get_range() { $count++; } self::assertEqual($count, 201); - - + + # Row count above total number of rows, buffer_size = total number of rows $cf = new ColumnFamily($this->pool, 'Standard1', true, true, $read_consistency_level=$cl, $write_consistency_level=$cl, @@ -299,7 +299,7 @@ public function test_insert_get_range() { $count++; } self::assertEqual($count, 201); - + $cf->truncate(); } @@ -420,7 +420,7 @@ public function test_batched_get_indexed_slices() { self::assertEqual($count, 201); - + # Row count above total number of rows, buffer_size = total number of rows $cf = new ColumnFamily($this->pool, 'Indexed1', true, true, $read_consistency_level=$cl, $write_consistency_level=$cl, @@ -432,8 +432,8 @@ public function test_batched_get_indexed_slices() { $count++; } self::assertEqual($count, 201); - - + + # Row count above total number of rows, buffer_size = total number of rows $cf = new ColumnFamily($this->pool, 'Indexed1', true, true, $read_consistency_level=$cl, $write_consistency_level=$cl, @@ -476,7 +476,7 @@ public function test_get_indexed_slices() { # Insert and remove a matching row at the end $indexed_cf->insert('key4', $columns); $indexed_cf->remove('key4'); - # Remove a matching row from the middle + # Remove a matching row from the middle $indexed_cf->remove('key2'); $result = $indexed_cf->get_indexed_slices($clause); diff --git a/thrift/transport/TServerSocket.php b/thrift/transport/TServerSocket.php index cac12ab7..4e69f043 100644 --- a/thrift/transport/TServerSocket.php +++ b/thrift/transport/TServerSocket.php @@ -90,7 +90,7 @@ protected function acceptImpl() { $socket = new TSocket(); $socket->setHandle($handle); - + return $socket; } } diff --git a/thrift/transport/TServerTransport.php b/thrift/transport/TServerTransport.php index e92ca77c..aff5600f 100644 --- a/thrift/transport/TServerTransport.php +++ b/thrift/transport/TServerTransport.php @@ -44,7 +44,7 @@ public function accept() { if ($transport == null) { throw new TTransportException("accept() may not return NULL"); } - + return $transport; } }