From 97a9134a3f496ea77b4a58ed173c8892739b044a Mon Sep 17 00:00:00 2001 From: Maks3w Date: Thu, 12 Jul 2012 21:11:36 +0200 Subject: [PATCH] [PSR-2] fixers=braces,elseif,short_tag,php_closing_tag,trailing_spaces,linefeed Applied php-cs-fixer --fixers=braces,elseif,short_tag,php_closing_tag,trailing_spaces,linefeed --- src/Filter/Regex.php | 2 +- src/Filter/Validator.php | 2 +- src/Formatter/ErrorHandler.php | 8 +++--- src/Formatter/ExceptionHandler.php | 4 +-- src/Writer/Db.php | 42 +++++++++++++++--------------- src/Writer/Mail.php | 4 +-- src/WriterPluginManager.php | 6 ++--- test/Filter/ValidatorTest.php | 2 +- test/Formatter/SimpleTest.php | 2 +- test/LoggerTest.php | 22 ++++++++-------- test/TestAsset/MockDbAdapter.php | 6 ++--- test/TestAsset/MockDbDriver.php | 2 +- test/TestAsset/MockDbPlatform.php | 2 +- test/Writer/DbTest.php | 16 ++++++------ test/Writer/MailTest.php | 14 +++++----- 15 files changed, 67 insertions(+), 67 deletions(-) diff --git a/src/Filter/Regex.php b/src/Filter/Regex.php index 1a1ebc03..fdfa1a8a 100644 --- a/src/Filter/Regex.php +++ b/src/Filter/Regex.php @@ -54,7 +54,7 @@ public function filter(array $event) { $message = $event['message']; if (is_array($event['message'])) { - $message = var_export($message, TRUE); + $message = var_export($message, TRUE); } return preg_match($this->regex, $message) > 0; } diff --git a/src/Filter/Validator.php b/src/Filter/Validator.php index 52f53b37..38c0bfa6 100644 --- a/src/Filter/Validator.php +++ b/src/Filter/Validator.php @@ -42,7 +42,7 @@ public function __construct(ZendValidator $validator) * Returns TRUE to accept the message, FALSE to block it. * * @param array $event event data - * @return boolean + * @return boolean */ public function filter(array $event) { diff --git a/src/Formatter/ErrorHandler.php b/src/Formatter/ErrorHandler.php index 64974ece..9e9b1f08 100644 --- a/src/Formatter/ErrorHandler.php +++ b/src/Formatter/ErrorHandler.php @@ -20,14 +20,14 @@ class ErrorHandler implements FormatterInterface { const DEFAULT_FORMAT = '%timestamp% %priorityName% (%priority%) %message% (errno %extra[errno]%) in %extra[file]% on line %extra[line]%'; - + /** * Format - * - * @var string + * + * @var string */ protected $format; - + /** * Class constructor * diff --git a/src/Formatter/ExceptionHandler.php b/src/Formatter/ExceptionHandler.php index 4619f429..ead0efdf 100644 --- a/src/Formatter/ExceptionHandler.php +++ b/src/Formatter/ExceptionHandler.php @@ -47,9 +47,9 @@ public function format($event) /** * Get the type of a function - * + * * @param string $type - * @return string + * @return string */ protected function getType($type) { diff --git a/src/Writer/Db.php b/src/Writer/Db.php index ebc6f6ef..a683cafa 100644 --- a/src/Writer/Db.php +++ b/src/Writer/Db.php @@ -30,8 +30,8 @@ class Db extends AbstractWriter /** * Table name - * - * @var string + * + * @var string */ protected $tableName; @@ -44,8 +44,8 @@ class Db extends AbstractWriter /** * Field separator for sub-elements - * - * @var string + * + * @var string */ protected $separator = '_'; @@ -53,8 +53,8 @@ class Db extends AbstractWriter * Constructor * * We used the Adapter instead of Zend\Db for a performance reason. - * - * @param Adapter $db + * + * @param Adapter $db * @param string $tableName * @param array $columnMap * @param string $separator @@ -66,11 +66,11 @@ public function __construct(Adapter $db, $tableName, array $columnMap = null, $s if ($db === null) { throw new Exception\InvalidArgumentException('You must pass a valid Zend\Db\Adapter\Adapter'); } - + $this->db = $db; $this->tableName = $tableName; $this->columnMap = $columnMap; - + if (!empty($separator)) { $this->separator = $separator; } @@ -120,34 +120,34 @@ protected function doWrite(array $event) $statement = $this->db->query($this->prepareInsert($this->db, $this->tableName, $dataToInsert)); $statement->execute($dataToInsert); - + } /** * Prepare the INSERT SQL statement - * + * * @param Adapter $db * @param string $tableName * @param array $fields - * @return string + * @return string */ - protected function prepareInsert(Adapter $db, $tableName, array $fields) - { + protected function prepareInsert(Adapter $db, $tableName, array $fields) + { $sql = 'INSERT INTO ' . $db->platform->quoteIdentifier($tableName) . ' (' . implode(",",array_map(array($db->platform, 'quoteIdentifier'), $fields)) . ') VALUES (' . implode(",",array_map(array($db->driver, 'formatParameterName'), $fields)) . ')'; - + return $sql; } /** * Map event into column using the $columnMap array - * + * * @param array $event * @param array $columnMap - * @return array + * @return array */ - protected function mapEventIntoColumn(array $event, array $columnMap = null) + protected function mapEventIntoColumn(array $event, array $columnMap = null) { if (empty($event)) { return array(); @@ -163,18 +163,18 @@ protected function mapEventIntoColumn(array $event, array $columnMap = null) } } elseif (isset($columnMap[$name])) { $data[$columnMap[$name]] = $value; - } + } } return $data; } /** * Transform event into column for the db table - * + * * @param array $event - * @return array + * @return array */ - protected function eventIntoColumn(array $event) + protected function eventIntoColumn(array $event) { if (empty($event)) { return array(); diff --git a/src/Writer/Mail.php b/src/Writer/Mail.php index 7200bc14..37511307 100644 --- a/src/Writer/Mail.php +++ b/src/Writer/Mail.php @@ -24,7 +24,7 @@ * completion, so any log entries accumulated are sent in a single email. * The email is sent using a Zend\Mail\Transport\TransportInterface object * (Sendmail is default). - * + * * @category Zend * @package Zend_Log * @subpackage Writer @@ -72,7 +72,7 @@ class Mail extends AbstractWriter /** * Constructor - * + * * @param MailMessage $mail * @param Transport\TransportInterface $transport Optional * @return Mail diff --git a/src/WriterPluginManager.php b/src/WriterPluginManager.php index 542f1141..8f45de19 100644 --- a/src/WriterPluginManager.php +++ b/src/WriterPluginManager.php @@ -21,7 +21,7 @@ class WriterPluginManager extends AbstractPluginManager { /** * Default set of writers - * + * * @var array */ protected $invokableClasses = array( @@ -39,8 +39,8 @@ class WriterPluginManager extends AbstractPluginManager * Validate the plugin * * Checks that the writer loaded is an instance of Writer\WriterInterface. - * - * @param mixed $plugin + * + * @param mixed $plugin * @return void * @throws Exception\InvalidArgumentException if invalid */ diff --git a/test/Filter/ValidatorTest.php b/test/Filter/ValidatorTest.php index 6c6af04b..3e7a1181 100644 --- a/test/Filter/ValidatorTest.php +++ b/test/Filter/ValidatorTest.php @@ -32,7 +32,7 @@ public function testValidatorFilter() $this->assertFalse($filter->filter(array('message' => 'test123'))); $this->assertFalse($filter->filter(array('message' => '(%$'))); } - + public function testValidatorChain() { $validatorChain = new ValidatorChain(); diff --git a/test/Formatter/SimpleTest.php b/test/Formatter/SimpleTest.php index b8361e54..a3f3f4e3 100644 --- a/test/Formatter/SimpleTest.php +++ b/test/Formatter/SimpleTest.php @@ -84,7 +84,7 @@ function testComplexValues() $line = $f->format($fields); $this->assertContains('object', $line); } - + /** * @group ZF-10427 */ diff --git a/test/LoggerTest.php b/test/LoggerTest.php index 121be8ef..597a6867 100644 --- a/test/LoggerTest.php +++ b/test/LoggerTest.php @@ -78,7 +78,7 @@ public function testPassWriterAsString() $writers = $this->logger->getWriters(); $this->assertInstanceOf('Zend\Stdlib\SplPriorityQueue', $writers); } - + /** * @dataProvider provideInvalidClasses */ @@ -93,7 +93,7 @@ public function testEmptyWriter() $this->setExpectedException('Zend\Log\Exception\RuntimeException', 'No log writer specified'); $this->logger->log(Logger::INFO, 'test'); } - + public function testSetWriters() { $writer1 = $this->logger->plugin('mock'); @@ -102,7 +102,7 @@ public function testSetWriters() $writers->insert($writer1, 1); $writers->insert($writer2, 2); $this->logger->setWriters($writers); - + $writers = $this->logger->getWriters(); $this->assertInstanceOf('Zend\Stdlib\SplPriorityQueue', $writers); $writer = $writers->extract(); @@ -110,7 +110,7 @@ public function testSetWriters() $writer = $writers->extract(); $this->assertTrue($writer instanceof \Zend\Log\Writer\Mock); } - + public function testAddWriterWithPriority() { $writer1 = $this->logger->plugin('mock'); @@ -124,9 +124,9 @@ public function testAddWriterWithPriority() $this->assertTrue($writer instanceof \Zend\Log\Writer\Null); $writer = $writers->extract(); $this->assertTrue($writer instanceof \Zend\Log\Writer\Mock); - + } - + public function testAddWithSamePriority() { $writer1 = $this->logger->plugin('mock'); @@ -141,17 +141,17 @@ public function testAddWithSamePriority() $writer = $writers->extract(); $this->assertTrue($writer instanceof \Zend\Log\Writer\Null); } - + public function testLogging() { $writer = new MockWriter; $this->logger->addWriter($writer); $this->logger->log(Logger::INFO, 'tottakai'); - + $this->assertEquals(count($writer->events), 1); $this->assertContains('tottakai', $writer->events[0]['message']); } - + public function testLoggingArray() { $writer = new MockWriter; @@ -161,7 +161,7 @@ public function testLoggingArray() $this->assertEquals(count($writer->events), 1); $this->assertContains('test', $writer->events[0]['message']); } - + public static function provideAttributes() { return array( @@ -205,7 +205,7 @@ public function testPassingInvalidArgumentToLogRaisesException($message, $extra) $this->setExpectedException('Zend\Log\Exception\InvalidArgumentException'); $this->logger->log(Logger::ERR, $message, $extra); } - + public function testRegisterErrorHandler() { $writer = new MockWriter; diff --git a/test/TestAsset/MockDbAdapter.php b/test/TestAsset/MockDbAdapter.php index 45d12f55..6f8eec29 100644 --- a/test/TestAsset/MockDbAdapter.php +++ b/test/TestAsset/MockDbAdapter.php @@ -16,19 +16,19 @@ class MockDbAdapter extends DbAdapter { public $plaftorm; public $driver; - + public $calls = array(); public function __call($method, $params) { $this->calls[$method][] = $params; } - + public function __construct() { $this->platform = new MockDbPlatform; $this->driver = new MockDbDriver; - + } public function query($sql, $parametersOrQueryMode = DbAdapter::QUERY_MODE_PREPARE) { diff --git a/test/TestAsset/MockDbDriver.php b/test/TestAsset/MockDbDriver.php index f8db617a..56c667f7 100644 --- a/test/TestAsset/MockDbDriver.php +++ b/test/TestAsset/MockDbDriver.php @@ -17,5 +17,5 @@ public function __call($method, $params) { $this->calls[$method][] = $params; } - + } diff --git a/test/TestAsset/MockDbPlatform.php b/test/TestAsset/MockDbPlatform.php index 30abff8b..a0d9415c 100644 --- a/test/TestAsset/MockDbPlatform.php +++ b/test/TestAsset/MockDbPlatform.php @@ -17,5 +17,5 @@ public function __call($method, $params) { $this->calls[$method][] = $params; } - + } diff --git a/test/Writer/DbTest.php b/test/Writer/DbTest.php index d30e8175..35f5946f 100644 --- a/test/Writer/DbTest.php +++ b/test/Writer/DbTest.php @@ -57,7 +57,7 @@ public function testWriteWithDefaults() } public function testWriteWithDefaultsUsingArray() - { + { // log to the mock db adapter $message = 'message-to-log'; $priority = 2; @@ -81,11 +81,11 @@ public function testWriteWithDefaultsUsingArray() ); $this->assertEquals(array($binds), $this->db->calls['execute'][0]); } - + public function testWriteWithDefaultsUsingArrayAndSeparator() - { + { $this->writer = new DbWriter($this->db, $this->tableName, null, '-'); - + // log to the mock db adapter $message = 'message-to-log'; $priority = 2; @@ -109,12 +109,12 @@ public function testWriteWithDefaultsUsingArrayAndSeparator() ); $this->assertEquals(array($binds), $this->db->calls['execute'][0]); } - + public function testWriteUsesOptionalCustomColumnNames() { $this->writer = new DbWriter($this->db, $this->tableName, array( 'message' => 'new-message-field' , - 'priority' => 'new-priority-field' + 'priority' => 'new-priority-field' )); // log to the mock db adapter @@ -136,7 +136,7 @@ public function testWriteUsesOptionalCustomColumnNames() ); $this->assertEquals(array($binds), $this->db->calls['execute'][0]); } - + public function testWriteUsesParamsWithArray() { $this->writer = new DbWriter($this->db, $this->tableName, array( @@ -147,7 +147,7 @@ public function testWriteUsesParamsWithArray() 'file' => 'new-file' ) )); - + // log to the mock db adapter $message = 'message-to-log'; $priority = 2; diff --git a/test/Writer/MailTest.php b/test/Writer/MailTest.php index 5119ad92..cc01fcb6 100644 --- a/test/Writer/MailTest.php +++ b/test/Writer/MailTest.php @@ -30,10 +30,10 @@ class MailTest extends \PHPUnit_Framework_TestCase */ protected $writer; /** - * @var Logger + * @var Logger */ protected $log; - + protected function setUp() { $message = new MailMessage(); @@ -48,7 +48,7 @@ protected function setUp() $this->writer = new MailWriter($message, $transport); $this->log = new Logger(); - $this->log->addWriter($this->writer); + $this->log->addWriter($this->writer); } protected function tearDown() @@ -62,11 +62,11 @@ protected function tearDown() * @return void */ public function testNormalLoggingMultiplePerLevel() - { + { $this->log->info('an info message'); $this->log->info('a second info message'); unset($this->log); - + $contents = file_get_contents(__DIR__ . '/' . self::FILENAME); $this->assertContains('an info message', $contents); $this->assertContains('a second info message', $contents); @@ -75,11 +75,11 @@ public function testNormalLoggingMultiplePerLevel() public function testSetSubjectPrependText() { $this->writer->setSubjectPrependText('test'); - + $this->log->info('an info message'); $this->log->info('a second info message'); unset($this->log); - + $contents = file_get_contents(__DIR__ . '/' . self::FILENAME); $this->assertContains('an info message', $contents); $this->assertContains('Subject: test', $contents);