Skip to content

Commit

Permalink
Coding standards
Browse files Browse the repository at this point in the history
  • Loading branch information
stijnhau committed Aug 28, 2016
1 parent 8fe16b6 commit 7a2a5ae
Show file tree
Hide file tree
Showing 14 changed files with 34 additions and 31 deletions.
12 changes: 8 additions & 4 deletions src/ZfcUser/Db/Adapter/MasterSlaveAdapter.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<?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
{
/**
Expand All @@ -17,10 +19,12 @@ class MasterSlaveAdapter extends Adapter implements MasterSlaveAdapterInterface
* @param Platform\PlatformInterface $platform
* @param ResultSet\ResultSet $queryResultPrototype
*/
public function __construct(Adapter $slaveAdapter, $driver,
Platform\PlatformInterface $platform = null,
ResultSet\ResultSetInterface $queryResultPrototype = null)
{
public function __construct(
Adapter $slaveAdapter,
$driver,
Platform\PlatformInterface $platform = null,
ResultSet\ResultSetInterface $queryResultPrototype = null
) {
$this->slaveAdapter = $slaveAdapter;
parent::__construct($driver, $platform, $queryResultPrototype);
}
Expand Down
1 change: 1 addition & 0 deletions src/ZfcUser/Db/Adapter/MasterSlaveAdapterInterface.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php
namespace ZfcUser\Db\Adapter;

interface MasterSlaveAdapterInterface
{
/**
Expand Down
1 change: 1 addition & 0 deletions src/ZfcUser/EventManager/EventProvider.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php
namespace ZfcUser\EventManager;

use Traversable;
use Zend\EventManager\EventManagerAwareInterface;
use Zend\EventManager\EventManagerInterface;
Expand Down
1 change: 0 additions & 1 deletion src/ZfcUser/Factory/Controller/RedirectCallbackFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

namespace ZfcUser\Factory\Controller;


use Interop\Container\ContainerInterface;
use Interop\Container\Exception\ContainerException;
use Zend\Mvc\Application;
Expand Down
2 changes: 2 additions & 0 deletions src/ZfcUser/Form/ProvidesEventsForm.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
<?php
namespace ZfcUser\Form;

use Traversable;
use Zend\Form\Form;
use Zend\EventManager\EventManagerInterface;
use Zend\EventManager\EventManager;

class ProvidesEventsForm extends Form
{
/**
Expand Down
2 changes: 2 additions & 0 deletions src/ZfcUser/InputFilter/ProvidesEventsInputFilter.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<?php
namespace ZfcUser\InputFilter;

use Zend\InputFilter\InputFilter;
use Zend\EventManager\EventManagerInterface;
use Zend\EventManager\EventManager;

class ProvidesEventsInputFilter extends InputFilter
{
/**
Expand Down
8 changes: 6 additions & 2 deletions src/ZfcUser/Mapper/AbstractDbMapper.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php
namespace ZfcUser\Mapper;

use Zend\Db\Adapter\Adapter;
use Zend\Db\Adapter\Driver\ResultInterface;
use Zend\Db\ResultSet\HydratingResultSet;
Expand All @@ -10,6 +11,7 @@
use Zend\Hydrator\ClassMethods;
use ZfcUser\EventManager\EventProvider;
use ZfcUser\Db\Adapter\MasterSlaveAdapterInterface;

abstract class AbstractDbMapper extends EventProvider
{
/**
Expand Down Expand Up @@ -92,8 +94,10 @@ protected function select(Select $select, $entityPrototype = null, HydratorInter
{
$this->initialize();
$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
2 changes: 1 addition & 1 deletion src/ZfcUser/Options/ModuleOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ public function getAllowedLoginStates()
* @param Array $states
* @return ModuleOptions
*/
public function setAllowedLoginStates(Array $states)
public function setAllowedLoginStates(array $states)
{
$this->allowedLoginStates = $states;
return $this;
Expand Down
4 changes: 2 additions & 2 deletions src/ZfcUser/Options/UserServiceOptionsInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
use ZfcUser\Options\RegistrationOptionsInterface;

interface UserServiceOptionsInterface extends
RegistrationOptionsInterface,
AuthenticationOptionsInterface
RegistrationOptionsInterface,
AuthenticationOptionsInterface
{
/**
* set user entity class name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace ZfcUserTest\Authentication\Adapter;


use ZfcUserTest\Authentication\Adapter\TestAsset\AbstractAdapterExtension;

class AbstractAdapterTest extends \PHPUnit_Framework_TestCase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class AdapterChainServiceFactoryTest extends \PHPUnit_Framework_TestCase

protected $serviceLocatorArray;

public function helperServiceLocator ($index)
public function helperServiceLocator($index)
{
return $this->serviceLocatorArray[$index];
}
Expand Down
21 changes: 6 additions & 15 deletions tests/ZfcUserTest/Controller/UserControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,6 @@ public function testLoginActionValidFormRedirectFalse($isValid, $wantRedirect)
->will($this->returnValue($expectedResult));

$this->pluginManagerPlugins['forward']= $forwardPlugin;

} else {
$response = new Response();

Expand Down Expand Up @@ -429,7 +428,6 @@ public function testAuthenticateAction($wantRedirect, $post, $query, $prepareRes
));

if (is_bool($prepareResult)) {

$authResult = $this->getMockBuilder('Zend\Authentication\Result')
->disableOriginalConstructor()
->getMock();
Expand Down Expand Up @@ -476,7 +474,6 @@ public function testAuthenticateAction($wantRedirect, $post, $query, $prepareRes
->with($controller::ROUTE_LOGIN)
->will($this->returnValue('user/login'));
$this->pluginManagerPlugins['url'] = $url;

} else {
$this->redirectCallback->expects($this->once())
->method('__invoke');
Expand All @@ -485,7 +482,6 @@ public function testAuthenticateAction($wantRedirect, $post, $query, $prepareRes
$this->options->expects($this->any())
->method('getUseRedirectParameterIfPresent')
->will($this->returnValue((bool) $wantRedirect));

}

$result = $controller->authenticateAction();
Expand Down Expand Up @@ -729,7 +725,6 @@ public function testChangepasswordAction($status, $postRedirectGetReturn, $isVal
->will($this->returnValue($postRedirectGetReturn));

if ($postRedirectGetReturn !== false && !($postRedirectGetReturn instanceof Response)) {

$form->expects($this->once())
->method('setData')
->with($postRedirectGetReturn);
Expand Down Expand Up @@ -777,7 +772,6 @@ public function testChangepasswordAction($status, $postRedirectGetReturn, $isVal
if ($postRedirectGetReturn instanceof Response) {
$this->assertInstanceOf('Zend\Http\Response', $result);
$this->assertSame($postRedirectGetReturn, $result);

} else {
if ($postRedirectGetReturn === false) {
$exceptedReturn = array(
Expand Down Expand Up @@ -875,7 +869,6 @@ public function testChangeEmailAction($status, $postRedirectGetReturn, $isValid,
->will($this->returnValue($postRedirectGetReturn));

if ($postRedirectGetReturn !== false && !($postRedirectGetReturn instanceof Response)) {

$form->expects($this->once())
->method('setData')
->with($postRedirectGetReturn);
Expand All @@ -885,7 +878,6 @@ public function testChangeEmailAction($status, $postRedirectGetReturn, $isValid,
->will($this->returnValue((bool) $isValid));

if ($isValid) {

$userService->expects($this->once())
->method('changeEmail')
->with($postRedirectGetReturn)
Expand Down Expand Up @@ -920,7 +912,6 @@ public function testChangeEmailAction($status, $postRedirectGetReturn, $isValid,
if ($postRedirectGetReturn instanceof Response) {
$this->assertInstanceOf('Zend\Http\Response', $result);
$this->assertSame($postRedirectGetReturn, $result);

} else {
if ($postRedirectGetReturn === false) {
$exceptedReturn = array(
Expand Down Expand Up @@ -985,15 +976,15 @@ public function testSetterGetterServices(
$this->assertSame($servicePrototype, $result);
}

public function providerTrueOrFalse ()
public function providerTrueOrFalse()
{
return array(
array(true),
array(false),
);
}

public function providerTrueOrFalseX2 ()
public function providerTrueOrFalseX2()
{
return array(
array(true,true),
Expand All @@ -1003,7 +994,7 @@ public function providerTrueOrFalseX2 ()
);
}

public function providerTestAuthenticateAction ()
public function providerTestAuthenticateAction()
{
// $redirect, $post, $query, $prepareResult = false, $authValid = false
return array(
Expand All @@ -1028,7 +1019,7 @@ public function providerTestAuthenticateAction ()
);
}

public function providerRedirectPostQueryMatrix ()
public function providerRedirectPostQueryMatrix()
{
return array(
array(false, false, false),
Expand All @@ -1039,7 +1030,7 @@ public function providerRedirectPostQueryMatrix ()
);
}

public function providerTestSetterGetterServices ()
public function providerTestSetterGetterServices()
{
$that = $this;
$loginFormCallback[] = function ($that, $controller) {
Expand Down Expand Up @@ -1175,7 +1166,7 @@ public function providerTestRegisterAction()
* @param mixed $value = null
* @return \ReflectionProperty
*/
public function helperMakePropertyAccessable ($objectOrClass, $property, $value = null)
public function helperMakePropertyAccessable($objectOrClass, $property, $value = null)
{
$reflectionProperty = new \ReflectionProperty($objectOrClass, $property);
$reflectionProperty->setAccessible(true);
Expand Down
2 changes: 1 addition & 1 deletion tests/ZfcUserTest/Form/RegisterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public function testSetCaptchaElement()
* @param mixed $value = null
* @return \ReflectionProperty
*/
public function helperMakePropertyAccessable ($objectOrClass, $property, $value = null)
public function helperMakePropertyAccessable($objectOrClass, $property, $value = null)
{
$reflectionProperty = new \ReflectionProperty($objectOrClass, $property);
$reflectionProperty->setAccessible(true);
Expand Down
6 changes: 3 additions & 3 deletions view/zfc-user/user/_form.phtml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?php echo $this->form()->openTag($form) ?>
<dl class="zend_form">
<?php foreach ($form as $element): ?>
<?php if ($element->getLabel() != null && !$element instanceof Zend\Form\Element\Button): ?>
<?php foreach ($form as $element) : ?>
<?php if ($element->getLabel() != null && !$element instanceof Zend\Form\Element\Button) : ?>
<dt><?php echo $this->formLabel($element) ?></dt>
<?php endif ?>
<dd><?php echo $this->formElement($element) . $this->formElementErrors($element) ?></dd>
<?php endforeach ?>
</dl>
<?php if ($this->redirect): ?>
<?php if ($this->redirect) : ?>
<input type="hidden" name="redirect" value="<?php echo $this->redirect ?>">
<?php endif ?>
<?php echo $this->form()->closeTag() ?>

0 comments on commit 7a2a5ae

Please sign in to comment.