diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..1997ca9 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,15 @@ +# @see http://editorconfig.org/ + +# This is the top-most .editorconfig file; do not search in parent directories. +root = true + +# All files. +[*] +indent_style = space +indent_size = 4 +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[composer.json] +indent_size = 4 diff --git a/composer.json b/composer.json index 44d740b..82a9d31 100644 --- a/composer.json +++ b/composer.json @@ -13,7 +13,9 @@ } ], "autoload": { - "classmap": ["."] + "classmap": [ + "." + ] }, "require-dev": { "phpunit/phpunit": "4.1.*" diff --git a/examples/basic.php b/examples/basic.php index e29bdec..5744525 100644 --- a/examples/basic.php +++ b/examples/basic.php @@ -28,21 +28,29 @@ $csv->auto('_books.csv'); ?> - - titles as $value): ?> - - - - data as $key => $row): ?> - - - - - - + + titles as $value): ?> + + + + data as $key => $row): ?> + + + + + +
diff --git a/examples/conditions.php b/examples/conditions.php index 7710c1c..c778b1d 100644 --- a/examples/conditions.php +++ b/examples/conditions.php @@ -28,21 +28,29 @@ $csv->auto('_books.csv'); ?> - - titles as $value): ?> - - - - data as $key => $row): ?> - - - - - - -
\ No newline at end of file + + titles as $value): ?> + + + + data as $key => $row): ?> + + + + + + + diff --git a/examples/limit.php b/examples/limit.php index 08556d9..a018f59 100644 --- a/examples/limit.php +++ b/examples/limit.php @@ -41,21 +41,29 @@ $csv->auto('_books.csv'); ?> - - titles as $value): ?> - - - - data as $key => $row): ?> - - - - - - -
\ No newline at end of file + + titles as $value): ?> + + + + data as $key => $row): ?> + + + + + + + diff --git a/tests/properties/default_values_test.php b/tests/properties/default_values_test.php index 6f4fe23..2117094 100644 --- a/tests/properties/default_values_test.php +++ b/tests/properties/default_values_test.php @@ -1,6 +1,7 @@ assertTrue(is_array($this->csv->fields)); - $this->assertCount(0,$this->csv->fields); + $this->assertCount(0, $this->csv->fields); } public function test_sort_by_default() { @@ -56,12 +57,12 @@ class default_values_properties_Test extends PHPUnit\Framework\TestCase { public function test_delimiter_default() { $this->assertTrue(is_string($this->csv->delimiter)); - $this->assertEquals(',',$this->csv->delimiter); + $this->assertEquals(',', $this->csv->delimiter); } public function test_enclosure_default() { $this->assertTrue(is_string($this->csv->enclosure)); - $this->assertEquals('"',$this->csv->enclosure); + $this->assertEquals('"', $this->csv->enclosure); } public function test_enclose_all_default() { @@ -83,17 +84,17 @@ class default_values_properties_Test extends PHPUnit\Framework\TestCase { public function test_auto_depth_default() { $this->assertTrue(is_numeric($this->csv->auto_depth)); - $this->assertEquals(15,$this->csv->auto_depth); + $this->assertEquals(15, $this->csv->auto_depth); } public function test_auto_non_chars_default() { $this->assertTrue(is_string($this->csv->auto_non_chars)); - $this->assertEquals("a-zA-Z0-9\n\r",$this->csv->auto_non_chars); + $this->assertEquals("a-zA-Z0-9\n\r", $this->csv->auto_non_chars); } public function test_auto_preferred_default() { $this->assertTrue(is_string($this->csv->auto_preferred)); - $this->assertEquals(",;\t.:|",$this->csv->auto_preferred); + $this->assertEquals(",;\t.:|", $this->csv->auto_preferred); } public function test_convert_encoding_default() { @@ -103,27 +104,27 @@ class default_values_properties_Test extends PHPUnit\Framework\TestCase { public function test_input_encoding_default() { $this->assertTrue(is_string($this->csv->input_encoding)); - $this->assertEquals('ISO-8859-1',$this->csv->input_encoding); + $this->assertEquals('ISO-8859-1', $this->csv->input_encoding); } public function test_output_encoding_default() { $this->assertTrue(is_string($this->csv->output_encoding)); - $this->assertEquals('ISO-8859-1',$this->csv->output_encoding); + $this->assertEquals('ISO-8859-1', $this->csv->output_encoding); } public function test_linefeed_default() { $this->assertTrue(is_string($this->csv->linefeed)); - $this->assertEquals("\r",$this->csv->linefeed); + $this->assertEquals("\r", $this->csv->linefeed); } public function test_output_delimiter_default() { $this->assertTrue(is_string($this->csv->output_delimiter)); - $this->assertEquals(',',$this->csv->output_delimiter); + $this->assertEquals(',', $this->csv->output_delimiter); } public function test_output_filename_default() { $this->assertTrue(is_string($this->csv->output_filename)); - $this->assertEquals('data.csv',$this->csv->output_filename); + $this->assertEquals('data.csv', $this->csv->output_filename); } public function test_keep_file_data_default() { @@ -141,21 +142,21 @@ class default_values_properties_Test extends PHPUnit\Framework\TestCase { public function test_error_default() { $this->assertTrue(is_numeric($this->csv->error)); - $this->assertEquals(0,$this->csv->error); + $this->assertEquals(0, $this->csv->error); } public function test_error_info_default() { $this->assertTrue(is_array($this->csv->error_info)); - $this->assertCount(0,$this->csv->error_info); + $this->assertCount(0, $this->csv->error_info); } public function test_titles_default() { $this->assertTrue(is_array($this->csv->titles)); - $this->assertCount(0,$this->csv->titles); + $this->assertCount(0, $this->csv->titles); } public function test_data_default() { $this->assertTrue(is_array($this->csv->data)); - $this->assertCount(0,$this->csv->data); + $this->assertCount(0, $this->csv->data); } } diff --git a/tests/properties/worthless_test.php b/tests/properties/worthless_test.php index dd259f3..389f118 100644 --- a/tests/properties/worthless_test.php +++ b/tests/properties/worthless_test.php @@ -1,6 +1,7 @@ assertCount(27,$this->properties); + $this->assertCount(27, $this->properties); } /** @@ -109,17 +110,17 @@ class worthless_properties_Test extends PHPUnit\Framework\TestCase { ); //find our real properties - $real_properties = array(); - for ($a=0; $aproperties); $a++) { + $real_properties = []; + for ($a = 0; $a < count($this->properties); $a++) { $real_properties[] = $this->properties[$a]->getName(); } //lets make sure our expected matches the number of real properties - $this->assertCount(count($names),$this->properties); + $this->assertCount(count($names), $this->properties); //lets loop through our expected to make sure they exists - for ($a=0; $aassertTrue(in_array($names[$a],$real_properties)); + for ($a = 0; $a < count($names); $a++) { + $this->assertTrue(in_array($names[$a], $real_properties)); } } @@ -133,12 +134,12 @@ class worthless_properties_Test extends PHPUnit\Framework\TestCase { public function test_count_public_properties() { $counter = 0; - for ($a=0; $aproperties); $a++) { + for ($a = 0; $a < count($this->properties); $a++) { if ($this->properties[$a]->isPublic() === true) { $counter++; } } - $this->assertCount($counter,$this->properties); + $this->assertCount($counter, $this->properties); } }