Skip to content

Commit

Permalink
Fix: Run phpcbf on code base
Browse files Browse the repository at this point in the history
  • Loading branch information
localheinz committed Nov 22, 2014
1 parent da0baa1 commit 3b27549
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 53 deletions.
2 changes: 1 addition & 1 deletion autoload_classmap.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
'ZfcBase\Mapper\AbstractDbMapper' => __DIR__ . '/src/ZfcBase/Mapper/AbstractDbMapper.php',
'ZfcBase\EventManager\EventProvider' => __DIR__ . '/src/ZfcBase/EventManager/EventProvider.php',
'ZfcBase\Module\AbstractModule' => __DIR__ . '/src/ZfcBase/Module/AbstractModule.php',
);
);
84 changes: 43 additions & 41 deletions src/ZfcBase/Db/Adapter/MasterSlaveAdapter.php
Original file line number Diff line number Diff line change
@@ -1,41 +1,43 @@
<?php

namespace ZfcBase\Db\Adapter;

use Zend\Db\Adapter\Adapter;
use Zend\Db\Adapter\Platform;
use Zend\Db\ResultSet;

class MasterSlaveAdapter extends Adapter implements MasterSlaveAdapterInterface
{
/**
* slave adapter
*
* @var Adapter
*/
protected $slaveAdapter;

/**
* @param Adapter $slaveAdapter
* @param Driver\DriverInterface|array $driver
* @param Platform\PlatformInterface $platform
* @param ResultSet\ResultSet $queryResultPrototype
*/
public function __construct(Adapter $slaveAdapter, $driver,
Platform\PlatformInterface $platform = null,
ResultSet\ResultSetInterface $queryResultPrototype = null)
{
$this->slaveAdapter = $slaveAdapter;
parent::__construct($driver, $platform, $queryResultPrototype);
}

/**
* get slave adapter
*
* @return Adapter
*/
public function getSlaveAdapter()
{
return $this->slaveAdapter;
}
}
<?php

namespace ZfcBase\Db\Adapter;

use Zend\Db\Adapter\Adapter;
use Zend\Db\Adapter\Platform;
use Zend\Db\ResultSet;

class MasterSlaveAdapter extends Adapter implements MasterSlaveAdapterInterface
{
/**
* slave adapter
*
* @var Adapter
*/
protected $slaveAdapter;

/**
* @param Adapter $slaveAdapter
* @param Driver\DriverInterface|array $driver
* @param Platform\PlatformInterface $platform
* @param ResultSet\ResultSet $queryResultPrototype
*/
public function __construct(
Adapter $slaveAdapter,
$driver,
Platform\PlatformInterface $platform = null,
ResultSet\ResultSetInterface $queryResultPrototype = null
) {
$this->slaveAdapter = $slaveAdapter;
parent::__construct($driver, $platform, $queryResultPrototype);
}

/**
* get slave adapter
*
* @return Adapter
*/
public function getSlaveAdapter()
{
return $this->slaveAdapter;
}
}
6 changes: 4 additions & 2 deletions src/ZfcBase/Mapper/AbstractDbMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,10 @@ protected function select(Select $select, $entityPrototype = null, HydratorInter

$stmt = $this->getSlaveSql()->prepareStatementForSqlObject($select);

$resultSet = new HydratingResultSet($hydrator ?: $this->getHydrator(),
$entityPrototype ?: $this->getEntityPrototype());
$resultSet = new HydratingResultSet(
$hydrator ?: $this->getHydrator(),
$entityPrototype ?: $this->getEntityPrototype()
);

$resultSet->initialize($stmt->execute());
return $resultSet;
Expand Down
3 changes: 2 additions & 1 deletion src/ZfcBase/Mapper/Exception/ExceptionInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
namespace ZfcBase\Mapper\Exception;

interface ExceptionInterface
{}
{
}
3 changes: 2 additions & 1 deletion src/ZfcBase/Mapper/Exception/InvalidArgumentException.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
namespace ZfcBase\Mapper\Exception;

class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
{}
{
}
9 changes: 4 additions & 5 deletions src/ZfcBase/Module/AbstractModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public function setMergedConfig($mergedConfig)
public function getOptions($namespace = 'options')
{
$config = $this->getMergedConfig();
if(empty($config[$this->getNamespace()][$namespace])) {
if (empty($config[$this->getNamespace()][$namespace])) {
return array();
}

Expand Down Expand Up @@ -120,19 +120,18 @@ private function getOptionFromArray($options, array $option, $default, $origOpti
$currOption = array_shift($option);
//we need this fix to accept both array/ZendConfig -- there is know problem with offsetExists() in PHP
//if(array_key_exists($currOption, $options)) {
if(array_key_exists($currOption, $options) || ($options instanceof \Zend\Config\Config && $options->offsetExists($currOption))) {
if(count($option) >= 1) {
if (array_key_exists($currOption, $options) || ($options instanceof \Zend\Config\Config && $options->offsetExists($currOption))) {
if (count($option) >= 1) {
return $this->getOptionFromArray($options[$currOption], $option, $default, $origOption);
}

return $options[$currOption];
}

if($default !== null) {
if ($default !== null) {
return $default;
}

throw new InvalidArgumentException("Option '$origOption' is not set");
}

}
4 changes: 3 additions & 1 deletion test/Bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,9 @@ protected static function findParentPath($path)
$previousDir = '.';
while (!is_dir($dir . '/' . $path)) {
$dir = dirname($dir);
if ($previousDir === $dir) return false;
if ($previousDir === $dir) {
return false;
}
$previousDir = $dir;
}
return $dir . '/' . $path;
Expand Down
1 change: 0 additions & 1 deletion test/ZfcBaseTest/Form/ProvidesEventsFormTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,3 @@ public function testSetEventManagerWorks()
$this->assertSame($this->form->getEventManager(), $em);
}
}

0 comments on commit 3b27549

Please sign in to comment.