Skip to content

Commit

Permalink
CS fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
lsmith77 committed Jul 27, 2011
1 parent c237d70 commit ab10bd4
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/Jackalope/ObjectManager.php
Expand Up @@ -520,7 +520,7 @@ protected function pathArrayToPropertiesIterator($array)
$props = array();

//OPTIMIZE: get all the properties in one request?
foreach($array as $path) {
foreach ($array as $path) {
$prop = $this->getPropertyByPath($path); //FIXME: this will break if we have non-persisted move
$props[] = $prop;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Jackalope/Property.php
Expand Up @@ -245,7 +245,7 @@ public function getBinary()
if ($this->value != null) {
// new or updated property
$val = is_array($this->value) ? $this->value : array($this->value);
foreach($val as $s) {
foreach ($val as $s) {
$stream = fopen('php://memory', 'rwb+');
$pos = ftell($s);
stream_copy_to_stream($s, $stream);
Expand Down Expand Up @@ -479,7 +479,7 @@ public function getLength()
$vals = $this->isMultiple ? $this->value : array($this->value);
$ret = array();

foreach($vals as $value) {
foreach ($vals as $value) {
try {
$ret[] = strlen(PropertyType::convertType($value, PropertyType::STRING));
} catch (\Exception $e) {
Expand Down
14 changes: 7 additions & 7 deletions src/Jackalope/Session.php
Expand Up @@ -566,7 +566,7 @@ public function hasPermission($absPath, $actions)
$actualPermissions = $this->objectManager->getPermissions($absPath);
$requestedPermissions = explode(',', $actions);

foreach($requestedPermissions as $perm) {
foreach ($requestedPermissions as $perm) {
if (! in_array(strtolower(trim($perm)), $actualPermissions)) {
return false;
}
Expand Down Expand Up @@ -697,7 +697,7 @@ private function exportSystemViewRecursive($node, $stream, $skipBinary, $noRecur
fwrite($stream, '<sv:property sv:name="jcr:uuid" sv:type="String"><sv:value>'.$node->getIdentifier().'</sv:value></sv:property>');
}

foreach($node->getProperties() as $name => $property) {
foreach ($node->getProperties() as $name => $property) {
if ($name == 'jcr:primaryType' || $name == 'jcr:mixinTypes' || $name == 'jcr:uuid') {
// explicitly handled before
continue;
Expand All @@ -712,7 +712,7 @@ private function exportSystemViewRecursive($node, $stream, $skipBinary, $noRecur
. '>');
$values = $property->isMultiple() ? $property->getString() : array($property->getString());

foreach($values as $value) {
foreach ($values as $value) {
if (PropertyType::BINARY == $property->getType()) {
$val = base64_encode($value);
} else {
Expand All @@ -724,7 +724,7 @@ private function exportSystemViewRecursive($node, $stream, $skipBinary, $noRecur
fwrite($stream, "</sv:property>");
}
if (! $noRecurse) {
foreach($node as $child) {
foreach ($node as $child) {
$this->exportSystemViewRecursive($child, $stream, $skipBinary, $noRecurse);
}
}
Expand Down Expand Up @@ -795,7 +795,7 @@ private function exportDocumentViewRecursive($node, $stream, $skipBinary, $noRec
if ($root) {
$this->exportNamespaceDeclarations($stream);
}
foreach($node->getProperties() as $name => $property) {
foreach ($node->getProperties() as $name => $property) {
if ($property->isMultiple()) {
// skip multiple properties. jackrabbit does this too. cheap but whatever. use system view for a complete export
continue;
Expand All @@ -814,7 +814,7 @@ private function exportDocumentViewRecursive($node, $stream, $skipBinary, $noRec
fwrite($stream, '/>');
} else {
fwrite($stream, '>');
foreach($node as $child) {
foreach ($node as $child) {
$this->exportDocumentViewRecursive($child, $stream, $skipBinary, $noRecurse);
}
fwrite($stream, "</$nodename>");
Expand All @@ -829,7 +829,7 @@ private function escapeXmlName($name)
}
private function exportNamespaceDeclarations($stream)
{
foreach($this->workspace->getNamespaceRegistry() as $key => $uri) {
foreach ($this->workspace->getNamespaceRegistry() as $key => $uri) {
if (! empty($key)) { // no ns declaration for empty namespace
fwrite($stream, " xmlns:$key=\"$uri\"");
}
Expand Down
14 changes: 7 additions & 7 deletions src/Jackalope/Transport/Davex/Client.php
Expand Up @@ -534,8 +534,8 @@ private function decodeBinaryDom($xml)
throw new \PHPCR\RepositoryException("Failed to load xml data:\n\n$xml");
}
$ret = array();
foreach($dom->getElementsByTagNameNS(self::NS_DCR, 'values') as $node) {
foreach($node->getElementsByTagNameNS(self::NS_DCR, 'value') as $value) {
foreach ($dom->getElementsByTagNameNS(self::NS_DCR, 'values') as $node) {
foreach ($node->getElementsByTagNameNS(self::NS_DCR, 'value') as $value) {
if ($value->getAttributeNS(self::NS_DCR, 'type') != \PHPCR\PropertyType::TYPENAME_BINARY) {
throw new \PHPCR\RepositoryException('Expected binary value but got '.$value->getAttributeNS(self::NS_DCR, 'type'));
}
Expand Down Expand Up @@ -593,8 +593,8 @@ protected function getNodeReferences($path, $name = null, $weak_reference = fals

$references = array();

foreach($dom->getElementsByTagNameNS(self::NS_DCR, $identifier) as $node) {
foreach($node->getElementsByTagNameNS(self::NS_DAV, 'href') as $ref) {
foreach ($dom->getElementsByTagNameNS(self::NS_DCR, $identifier) as $node) {
foreach ($node->getElementsByTagNameNS(self::NS_DAV, 'href') as $ref) {
$refpath = str_replace($this->workspaceUriRoot, '', urldecode($ref->textContent));
if ($name === null || basename($refpath) === $name) {
$references[] = str_replace($this->workspaceUriRoot, '', urldecode($ref->textContent));
Expand Down Expand Up @@ -1298,9 +1298,9 @@ public function getPermissions($path)
$request->setTransactionId($this->transactionToken);
$dom = $request->executeDom();

foreach($dom->getElementsByTagNameNS(self::NS_DAV, 'current-user-privilege-set') as $node) {
foreach($node->getElementsByTagNameNS(self::NS_DAV, 'privilege') as $privilege) {
foreach($privilege->childNodes as $child) {
foreach ($dom->getElementsByTagNameNS(self::NS_DAV, 'current-user-privilege-set') as $node) {
foreach ($node->getElementsByTagNameNS(self::NS_DAV, 'privilege') as $privilege) {
foreach ($privilege->childNodes as $child) {
$permission = str_replace('dcr:', '', $child->tagName);
if (! in_array($permission, $valid_permissions)) {
throw new \PHPCR\RepositoryException("Invalid permission '$permission'");
Expand Down

0 comments on commit ab10bd4

Please sign in to comment.