Skip to content

Commit

Permalink
Fixed CS in the library code
Browse files Browse the repository at this point in the history
  • Loading branch information
stof committed Oct 5, 2014
1 parent 09f32bb commit bfaeee6
Show file tree
Hide file tree
Showing 210 changed files with 1,583 additions and 1,243 deletions.
2 changes: 1 addition & 1 deletion lib/Gedmo/Blameable/Blameable.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ interface Blameable
* @Column(type="string")
* $created
*/
}
}
5 changes: 3 additions & 2 deletions lib/Gedmo/Blameable/BlameableListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class BlameableListener extends TimestampableListener
*
* @param object $meta
* @param string $field
*
* @return mixed
*/
public function getUserValue($meta, $field)
Expand All @@ -38,7 +39,7 @@ public function getUserValue($meta, $field)
// ok so its not an association, then it is a string
if (is_object($this->user)) {
if (method_exists($this->user, 'getUsername')) {
return (string)$this->user->getUsername();
return (string) $this->user->getUsername();
}
if (method_exists($this->user, '__toString')) {
return $this->user->__toString();
Expand Down Expand Up @@ -70,7 +71,7 @@ protected function getNamespace()
/**
* Updates a field
*
* @param mixed $object
* @param object $object
* @param BlameableAdapter $ea
* @param $meta
* @param $field
Expand Down
5 changes: 2 additions & 3 deletions lib/Gedmo/Blameable/Mapping/Driver/Annotation.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@

namespace Gedmo\Blameable\Mapping\Driver;

use Gedmo\Mapping\Driver\AbstractAnnotationDriver,
Doctrine\Common\Annotations\AnnotationReader,
Gedmo\Exception\InvalidMappingException;
use Gedmo\Mapping\Driver\AbstractAnnotationDriver;
use Gedmo\Exception\InvalidMappingException;

/**
* This is an annotation mapping driver for Blameable
Expand Down
7 changes: 4 additions & 3 deletions lib/Gedmo/Blameable/Mapping/Driver/Xml.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace Gedmo\Blameable\Mapping\Driver;

use Gedmo\Mapping\Driver\Xml as BaseXml,
Gedmo\Exception\InvalidMappingException;
use Gedmo\Mapping\Driver\Xml as BaseXml;
use Gedmo\Exception\InvalidMappingException;

/**
* This is a xml mapping driver for Blameable
Expand All @@ -16,7 +16,6 @@
*/
class Xml extends BaseXml
{

/**
* List of types which are valid for blame
*
Expand Down Expand Up @@ -118,11 +117,13 @@ public function readExtendedMetadata($meta, array &$config)
*
* @param object $meta
* @param string $field
*
* @return boolean
*/
protected function isValidField($meta, $field)
{
$mapping = $meta->getFieldMapping($field);

return $mapping && in_array($mapping['type'], $this->validTypes);
}
}
12 changes: 7 additions & 5 deletions lib/Gedmo/Blameable/Mapping/Driver/Yaml.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace Gedmo\Blameable\Mapping\Driver;

use Gedmo\Mapping\Driver\File,
Gedmo\Mapping\Driver,
Gedmo\Exception\InvalidMappingException;
use Gedmo\Mapping\Driver\File;
use Gedmo\Mapping\Driver;
use Gedmo\Exception\InvalidMappingException;

/**
* This is a yaml mapping driver for Blameable
Expand Down Expand Up @@ -82,7 +82,7 @@ public function readExtendedMetadata($meta, array &$config)
if (!isset($mappingProperty['on']) || !in_array($mappingProperty['on'], array('update', 'create', 'change'))) {
throw new InvalidMappingException("Field - [{$field}] trigger 'on' is not one of [update, create, change] in class - {$meta->name}");
}

if ($mappingProperty['on'] == 'change') {
if (!isset($mappingProperty['field'])) {
throw new InvalidMappingException("Missing parameters on property - {$field}, field must be set on [change] trigger in class - {$meta->name}");
Expand Down Expand Up @@ -116,12 +116,14 @@ protected function _loadMappingFile($file)
* Checks if $field type is valid
*
* @param \Doctrine\ODM\MongoDB\Mapping\ClassMetadata $meta
* @param string $field
* @param string $field
*
* @return boolean
*/
protected function isValidField($meta, $field)
{
$mapping = $meta->getFieldMapping($field);

return $mapping && in_array($mapping['type'], $this->validTypes);
}
}
2 changes: 1 addition & 1 deletion lib/Gedmo/Blameable/Mapping/Event/Adapter/ODM.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
*/
final class ODM extends BaseAdapterODM implements BlameableAdapter
{
}
}
2 changes: 1 addition & 1 deletion lib/Gedmo/Blameable/Mapping/Event/Adapter/ORM.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
*/
final class ORM extends BaseAdapterORM implements BlameableAdapter
{
}
}
2 changes: 1 addition & 1 deletion lib/Gedmo/Blameable/Mapping/Event/BlameableAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
*/
interface BlameableAdapter extends AdapterInterface
{
}
}
24 changes: 12 additions & 12 deletions lib/Gedmo/DoctrineExtensions.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ final class DoctrineExtensions
* Hooks all extensions metadata mapping drivers
* into given $driverChain of drivers for ORM
*
* @param \Doctrine\Common\Persistence\Mapping\Driver\MappingDriverChain $driverChain
* @param \Doctrine\Common\Annotations\Reader $reader
* @param MappingDriverChain $driverChain
* @param Reader|null $reader
*/
public static function registerMappingIntoDriverChainORM(MappingDriverChain $driverChain, Reader $reader = null)
{
self::registerAnnotations();
if (!$reader) {
$reader = new CachedReader(new AnnotationReader, new ArrayCache);
$reader = new CachedReader(new AnnotationReader(), new ArrayCache());
}
$annotationDriver = new DriverORM\AnnotationDriver($reader, array(
__DIR__.'/Translatable/Entity',
Expand All @@ -50,14 +50,14 @@ public static function registerMappingIntoDriverChainORM(MappingDriverChain $dri
* Hooks only superclass metadata mapping drivers
* into given $driverChain of drivers for ORM
*
* @param \Doctrine\Common\Persistence\Mapping\Driver\MappingDriverChain $driverChain
* @param \Doctrine\Common\Annotations\Reader $reader
* @param MappingDriverChain $driverChain
* @param Reader|null $reader
*/
public static function registerAbstractMappingIntoDriverChainORM(MappingDriverChain $driverChain, Reader $reader = null)
{
self::registerAnnotations();
if (!$reader) {
$reader = new CachedReader(new AnnotationReader, new ArrayCache);
$reader = new CachedReader(new AnnotationReader(), new ArrayCache());
}
$annotationDriver = new DriverORM\AnnotationDriver($reader, array(
__DIR__.'/Translatable/Entity/MappedSuperclass',
Expand All @@ -71,14 +71,14 @@ public static function registerAbstractMappingIntoDriverChainORM(MappingDriverCh
* Hooks all extensions metadata mapping drivers
* into given $driverChain of drivers for ODM MongoDB
*
* @param \Doctrine\Common\Persistence\Mapping\Driver\MappingDriverChain $driverChain
* @param \Doctrine\Common\Annotations\Reader $reader
* @param MappingDriverChain $driverChain
* @param Reader|null $reader
*/
public static function registerMappingIntoDriverChainMongodbODM(MappingDriverChain $driverChain, Reader $reader = null)
{
self::registerAnnotations();
if (!$reader) {
$reader = new CachedReader(new AnnotationReader, new ArrayCache);
$reader = new CachedReader(new AnnotationReader(), new ArrayCache());
}
$annotationDriver = new DriverMongodbODM\AnnotationDriver($reader, array(
__DIR__.'/Translatable/Document',
Expand All @@ -91,14 +91,14 @@ public static function registerMappingIntoDriverChainMongodbODM(MappingDriverCha
* Hooks only superclass metadata mapping drivers
* into given $driverChain of drivers for ODM MongoDB
*
* @param \Doctrine\Common\Persistence\Mapping\Driver\MappingDriverChain $driverChain
* @param \Doctrine\Common\Annotations\Reader $reader
* @param MappingDriverChain $driverChain
* @param Reader|null $reader
*/
public static function registerAbstractMappingIntoDriverChainMongodbODM(MappingDriverChain $driverChain, Reader $reader = null)
{
self::registerAnnotations();
if (!$reader) {
$reader = new CachedReader(new AnnotationReader, new ArrayCache);
$reader = new CachedReader(new AnnotationReader(), new ArrayCache());
}
$annotationDriver = new DriverMongodbODM\AnnotationDriver($reader, array(
__DIR__.'/Translatable/Document/MappedSuperclass',
Expand Down
5 changes: 2 additions & 3 deletions lib/Gedmo/Exception.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Common package exception interface to allow
* users of caching only this package specific
* exceptions thrown
*
*
* @author Gediminas Morkevicius <[email protected]>
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
Expand All @@ -15,6 +15,5 @@ interface Exception
/**
* Following best practices for PHP5.3 package exceptions.
* All exceptions thrown in this package will have to implement this interface
*
*/
}
}
3 changes: 2 additions & 1 deletion lib/Gedmo/Exception/BadMethodCallException.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@
class BadMethodCallException
extends \BadMethodCallException
implements Exception
{}
{
}
3 changes: 2 additions & 1 deletion lib/Gedmo/Exception/FeatureNotImplementedException.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@
class FeatureNotImplementedException
extends \RuntimeException
implements Exception
{}
{
}
7 changes: 4 additions & 3 deletions lib/Gedmo/Exception/InvalidArgumentException.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@

/**
* InvalidArgumentException
*
*
* @author Gediminas Morkevicius <[email protected]>
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
class InvalidArgumentException
class InvalidArgumentException
extends \InvalidArgumentException
implements Exception
{}
{
}
9 changes: 5 additions & 4 deletions lib/Gedmo/Exception/InvalidMappingException.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@

/**
* InvalidMappingException
*
*
* Triggered when mapping user argument is not
* valid or incomplete.
*
*
* @author Gediminas Morkevicius <[email protected]>
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
class InvalidMappingException
class InvalidMappingException
extends InvalidArgumentException
implements Exception
{}
{
}
3 changes: 2 additions & 1 deletion lib/Gedmo/Exception/ReferenceIntegrityStrictException.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
class ReferenceIntegrityStrictException extends RuntimeException
{}
{
}
7 changes: 4 additions & 3 deletions lib/Gedmo/Exception/RuntimeException.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@

/**
* RuntimeException
*
*
* @author Gediminas Morkevicius <[email protected]>
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
class RuntimeException
class RuntimeException
extends \RuntimeException
implements Exception
{}
{
}
5 changes: 3 additions & 2 deletions lib/Gedmo/Exception/TreeLockingException.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@

/**
* TreeLockingException
*
*
* @author Gustavo Falco <[email protected]>
* @author Gediminas Morkevicius <[email protected]>
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
class TreeLockingException extends RuntimeException
{}
{
}
7 changes: 4 additions & 3 deletions lib/Gedmo/Exception/UnexpectedValueException.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@

/**
* UnexpectedValueException
*
*
* @author Gediminas Morkevicius <[email protected]>
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
class UnexpectedValueException
class UnexpectedValueException
extends \UnexpectedValueException
implements Exception
{}
{
}
5 changes: 3 additions & 2 deletions lib/Gedmo/Exception/UnsupportedObjectManagerException.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
* @author Gediminas Morkevicius <[email protected]>
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
class UnsupportedObjectManager
class UnsupportedObjectManagerException
extends InvalidArgumentException
implements Exception
{}
{
}
3 changes: 2 additions & 1 deletion lib/Gedmo/Exception/UploadableCantWriteException.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@
class UploadableCantWriteException
extends UploadableException
implements Exception
{}
{
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@
class UploadableCouldntGuessMimeTypeException
extends UploadableException
implements Exception
{}
{
}
3 changes: 2 additions & 1 deletion lib/Gedmo/Exception/UploadableDirectoryNotFoundException.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@
class UploadableDirectoryNotFoundException
extends UploadableException
implements Exception
{}
{
}
3 changes: 2 additions & 1 deletion lib/Gedmo/Exception/UploadableException.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@
class UploadableException
extends RuntimeException
implements Exception
{}
{
}
3 changes: 2 additions & 1 deletion lib/Gedmo/Exception/UploadableExtensionException.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@
class UploadableExtensionException
extends UploadableException
implements Exception
{}
{
}
3 changes: 2 additions & 1 deletion lib/Gedmo/Exception/UploadableFileAlreadyExistsException.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@
class UploadableFileAlreadyExistsException
extends UploadableException
implements Exception
{}
{
}
Loading

0 comments on commit bfaeee6

Please sign in to comment.