Skip to content

Commit

Permalink
apply styleci fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
lsmith77 committed Jul 22, 2015
1 parent 794632a commit 4a4498e
Show file tree
Hide file tree
Showing 79 changed files with 123 additions and 244 deletions.
1 change: 0 additions & 1 deletion src/Jackalope/Helper.php
Expand Up @@ -2,7 +2,6 @@
namespace Jackalope;

use DOMElement;

use PHPCR\RepositoryException;

/**
Expand Down
1 change: 0 additions & 1 deletion src/Jackalope/ImportExport/ImportExport.php
Expand Up @@ -3,7 +3,6 @@
namespace Jackalope\ImportExport;

use XMLReader;

use PHPCR\NodeInterface;
use PHPCR\PropertyType;
use PHPCR\ImportUUIDBehaviorInterface;
Expand Down
8 changes: 0 additions & 8 deletions src/Jackalope/Item.php
Expand Up @@ -4,7 +4,6 @@

use LogicException;
use PHPCR\Util\PathHelper;

use PHPCR\PropertyInterface;
use PHPCR\ItemInterface;
use PHPCR\ItemVisitorInterface;
Expand Down Expand Up @@ -689,35 +688,28 @@ public function rollbackTransaction()

// Case 1) and 2)
$this->state = self::STATE_DELETED;

} elseif (self::STATE_NEW === $this->savedState) {

// Case 3)
$this->state = self::STATE_NEW;

} elseif (self::STATE_MODIFIED === $this->state || self::STATE_MODIFIED === $this->savedState) {

// Case 4) and 5)
$this->state = self::STATE_MODIFIED;

} elseif (self::STATE_CLEAN === $this->savedState) {

if (self::STATE_CLEAN === $this->state) {

// Case 6) and 7), see the comment in the function setState()
$this->state = $this->savedState;

} elseif (self::STATE_DIRTY === $this->state) {

// Case 8)
$this->state = self::STATE_DIRTY;
}

} elseif (self::STATE_DIRTY === $this->savedState) {

// Case 9)
$this->state = self::STATE_DIRTY;

} else {

// There might be some special case we do not handle. for the moment throw an exception
Expand Down
1 change: 0 additions & 1 deletion src/Jackalope/Lock/Lock.php
Expand Up @@ -3,7 +3,6 @@
namespace Jackalope\Lock;

use PHPCR\Lock\LockInterface;

use Jackalope\NotImplementedException;

/**
Expand Down
5 changes: 2 additions & 3 deletions src/Jackalope/Lock/LockManager.php
Expand Up @@ -4,14 +4,12 @@

use ArrayIterator;
use IteratorAggregate;

use PHPCR\SessionInterface;
use PHPCR\PathNotFoundException;
use PHPCR\InvalidItemStateException;
use PHPCR\Lock\LockManagerInterface;
use PHPCR\Lock\LockInfoInterface;
use PHPCR\Lock\LockException;

use Jackalope\ObjectManager;
use Jackalope\FactoryInterface;
use Jackalope\Item;
Expand Down Expand Up @@ -260,7 +258,8 @@ public function createLockInfo()
*/
public function logout()
{
foreach ($this->locks as $path => $lock) {;
foreach ($this->locks as $path => $lock) {
;
if ($lock->isSessionScoped() && $lock->isLockOwningSession()) {
try {
$this->unlock($path); // will tell the lock its no longer live
Expand Down
2 changes: 0 additions & 2 deletions src/Jackalope/NamespaceRegistry.php
Expand Up @@ -5,12 +5,10 @@
use Iterator;
use ArrayIterator;
use IteratorAggregate;

use PHPCR\UnsupportedRepositoryOperationException;
use PHPCR\ItemNotFoundException;
use PHPCR\NamespaceRegistryInterface;
use PHPCR\NamespaceException;

use Jackalope\Transport\TransportInterface;
use Jackalope\Transport\WritingInterface;

Expand Down
11 changes: 3 additions & 8 deletions src/Jackalope/Node.php
Expand Up @@ -7,7 +7,6 @@
use Exception;
use InvalidArgumentException;
use LogicException;

use PHPCR\PropertyType;
use PHPCR\NodeInterface;
use PHPCR\NodeType\ConstraintViolationException;
Expand All @@ -17,10 +16,8 @@
use PHPCR\ItemNotFoundException;
use PHPCR\InvalidItemStateException;
use PHPCR\ItemExistsException;

use PHPCR\Util\PathHelper;
use PHPCR\Util\NodeHelper;

use Jackalope\Factory;

/**
Expand Down Expand Up @@ -358,7 +355,6 @@ public function addNode($relPath, $primaryNodeTypeName = null)
// with that name than if there is nothing at the path at all.
// lets see if the property exists
if ($this->session->propertyExists($parentPath)) {

throw new ConstraintViolationException("Node '{$this->path}': Not allowed to add a node below property at $parentPath");
}

Expand Down Expand Up @@ -799,7 +795,7 @@ public function getPrimaryItem()
}

if ($primary_item === null) {
throw new ItemNotFoundException("No primary item found for node '{$this->path}'");
throw new ItemNotFoundException("No primary item found for node '{$this->path}'");
}

return $primary_item;
Expand Down Expand Up @@ -1073,7 +1069,6 @@ public function setMixins(array $mixinNames)
$toRemove = array();
if ($this->hasProperty('jcr:mixinTypes')) {
foreach ($this->getPropertyValue('jcr:mixinTypes') as $mixin) {

if (false !== $key = array_search($mixin, $mixinNames)) {
unset($mixinNames[$key]);
} else {
Expand Down Expand Up @@ -1474,8 +1469,8 @@ protected static function filterNames($filter, $names)
$filtered = array();
$filter = (array) $filter;
foreach ($filter as $k => $f) {
$f = trim($f);
$filter[$k] = strtr($f, array('*'=>'.*', //wildcard
$f = trim($f);
$filter[$k] = strtr($f, array('*'=>'.*', //wildcard
'.' => '\\.', //escape regexp
'\\' => '\\\\',
'{' => '\\{',
Expand Down
1 change: 0 additions & 1 deletion src/Jackalope/NodePathIterator.php
Expand Up @@ -148,7 +148,6 @@ protected function loadBatch($position = null)
} else {
$this->nodes[$path] = null;
}

}
}

Expand Down
1 change: 0 additions & 1 deletion src/Jackalope/NodeType/ItemDefinition.php
Expand Up @@ -3,7 +3,6 @@
namespace Jackalope\NodeType;

use PHPCR\NodeType\ItemDefinitionInterface;

use Jackalope\FactoryInterface;

/**
Expand Down
1 change: 0 additions & 1 deletion src/Jackalope/NodeType/NodeDefinitionTemplate.php
Expand Up @@ -4,7 +4,6 @@

use PHPCR\NodeType\NodeDefinitionTemplateInterface;
use PHPCR\Version\OnParentVersionAction;

use Jackalope\FactoryInterface;

/**
Expand Down
8 changes: 3 additions & 5 deletions src/Jackalope/NodeType/NodeProcessor.php
Expand Up @@ -13,7 +13,6 @@
use PHPCR\ValueFormatException;
use PHPCR\Util\UUIDHelper;
use PHPCR\NamespaceException;

use Jackalope\Transport\AddNodeOperation;

/**
Expand Down Expand Up @@ -80,8 +79,7 @@ public function __construct(
$userId,
$namespaces = array(),
$autoLastModified = true
)
{
) {
$this->userId = (string) $userId;
$this->autoLastModified = $autoLastModified;
$this->namespaces = $namespaces;
Expand Down Expand Up @@ -212,7 +210,7 @@ private function processNodeWithType(NodeInterface $node, NodeType $nodeTypeDefi
} elseif ($propertyDef->isAutoCreated()) {
$prop = $node->getProperty($propertyDef->getName());
if (!$prop->isModified() && !$prop->isNew()) {
switch($propertyDef->getName()) {
switch ($propertyDef->getName()) {
case 'jcr:lastModified':
if ($this->autoLastModified) {
$prop->setValue(new \DateTime());
Expand Down Expand Up @@ -269,7 +267,7 @@ private function assertValidProperty(PropertyInterface $property)
$property->getPath(),
$prefix
));
}
}
}
}
break;
Expand Down
11 changes: 5 additions & 6 deletions src/Jackalope/NodeType/NodeType.php
Expand Up @@ -4,7 +4,6 @@

use ArrayIterator;
use Exception;

use PHPCR\PropertyType;
use PHPCR\ValueFormatException;
use PHPCR\NodeType\NodeTypeInterface;
Expand Down Expand Up @@ -289,15 +288,15 @@ public function canAddChildNode($childNodeName, $nodeTypeName = null, $throw = f
return false;
} catch (Exception $e) {
if ($throw) {
$errorMsg = "Can't add the child node '$childNodeName' for node type '$nodeTypeName' because of an Exception: " . $e->getMessage();
throw new ConstraintViolationException($errorMsg, null, $e);
$errorMsg = "Can't add the child node '$childNodeName' for node type '$nodeTypeName' because of an Exception: " . $e->getMessage();
throw new ConstraintViolationException($errorMsg, null, $e);
}

return false;
}
}
foreach ($childDefs as $child) {
if ( '*' == $child->getName() || $childNodeName == $child->getName()) {
if ('*' == $child->getName() || $childNodeName == $child->getName()) {
if ($nodeTypeName == null) {
if ($child->getDefaultPrimaryTypeName() != null) {
return true;
Expand Down Expand Up @@ -329,7 +328,7 @@ public function canRemoveNode($nodeName, $throw = false)
$childDefs = $this->getChildNodeDefinitions();
foreach ($childDefs as $child) {
if ($nodeName == $child->getName() &&
( $child->isMandatory() || $child->isProtected() )
($child->isMandatory() || $child->isProtected())
) {
if ($throw) {
if ($child->isMandatory()) {
Expand Down Expand Up @@ -357,7 +356,7 @@ public function canRemoveProperty($propertyName, $throw = false)
$propDefs = $this->getPropertyDefinitions();
foreach ($propDefs as $prop) {
if ($propertyName == $prop->getName() &&
( $prop->isMandatory() || $prop->isProtected() )
($prop->isMandatory() || $prop->isProtected())
) {
if ($throw) {
if ($prop->isMandatory()) {
Expand Down
3 changes: 0 additions & 3 deletions src/Jackalope/NodeType/NodeTypeDefinition.php
Expand Up @@ -5,9 +5,7 @@
use DOMXPath;
use ArrayObject;
use InvalidArgumentException;

use PHPCR\NodeType\NodeTypeDefinitionInterface;

use Jackalope\Helper;
use Jackalope\FactoryInterface;
use PHPCR\Util\ValueConverter;
Expand Down Expand Up @@ -262,5 +260,4 @@ public function getDeclaredChildNodeDefinitions()
return is_null($this->declaredNodeDefinitions)
? null : $this->declaredNodeDefinitions->getArrayCopy();
}

}
8 changes: 3 additions & 5 deletions src/Jackalope/NodeType/NodeTypeManager.php
Expand Up @@ -4,15 +4,13 @@

use IteratorAggregate;
use ArrayIterator;

use Jackalope\NamespaceRegistry;
use PHPCR\NamespaceRegistryInterface;
use PHPCR\NodeType\NodeTypeInterface;
use PHPCR\NodeType\NodeTypeDefinitionInterface;
use PHPCR\NodeType\NodeTypeManagerInterface;
use PHPCR\NodeType\NoSuchNodeTypeException;
use PHPCR\NodeType\NodeTypeExistsException;

use Jackalope\ObjectManager;
use Jackalope\NotImplementedException;
use Jackalope\FactoryInterface;
Expand Down Expand Up @@ -310,7 +308,7 @@ public function getMixinNodeTypes()
*/
public function createNodeTypeTemplate($ntd = null)
{
return $this->factory->get('NodeType\\NodeTypeTemplate', array($this, $ntd));
return $this->factory->get('NodeType\\NodeTypeTemplate', array($this, $ntd));
}

/**
Expand All @@ -320,7 +318,7 @@ public function createNodeTypeTemplate($ntd = null)
*/
public function createNodeDefinitionTemplate()
{
return $this->factory->get('NodeType\\NodeDefinitionTemplate', array($this));
return $this->factory->get('NodeType\\NodeDefinitionTemplate', array($this));
}

/**
Expand All @@ -330,7 +328,7 @@ public function createNodeDefinitionTemplate()
*/
public function createPropertyDefinitionTemplate()
{
return $this->factory->get('NodeType\\PropertyDefinitionTemplate', array($this));
return $this->factory->get('NodeType\\PropertyDefinitionTemplate', array($this));
}

/**
Expand Down
3 changes: 0 additions & 3 deletions src/Jackalope/NodeType/NodeTypeTemplate.php
Expand Up @@ -3,7 +3,6 @@
namespace Jackalope\NodeType;

use ArrayObject;

use PHPCR\NodeType\NodeTypeTemplateInterface;

/**
Expand All @@ -16,7 +15,6 @@
*/
class NodeTypeTemplate extends NodeTypeDefinition implements NodeTypeTemplateInterface
{

/**
* {@inheritDoc}
*
Expand Down Expand Up @@ -114,5 +112,4 @@ public function getNodeDefinitionTemplates()

return $this->declaredNodeDefinitions;
}

}
2 changes: 0 additions & 2 deletions src/Jackalope/NodeType/NodeTypeXmlConverter.php
Expand Up @@ -5,10 +5,8 @@
use DOMDocument;
use DOMElement;
use DOMXPath;

use PHPCR\PropertyType;
use PHPCR\Version\OnParentVersionAction;

use Jackalope\Helper;
use Jackalope\FactoryInterface;

Expand Down
2 changes: 0 additions & 2 deletions src/Jackalope/NodeType/PropertyDefinitionTemplate.php
Expand Up @@ -2,10 +2,8 @@
namespace Jackalope\NodeType;

use PHPCR\PropertyType;

use PHPCR\Version\OnParentVersionAction;
use PHPCR\NodeType\PropertyDefinitionTemplateInterface;

use Jackalope\FactoryInterface;

/**
Expand Down

0 comments on commit 4a4498e

Please sign in to comment.