Skip to content

Commit

Permalink
WS fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
lsmith77 committed May 9, 2011
1 parent 4e35018 commit 60bafe7
Showing 1 changed file with 16 additions and 19 deletions.
35 changes: 16 additions & 19 deletions src/Jackalope/Transport/Davex/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ public function getProperty($path)
public function getBinaryStream($path)
{
$request = $this->getRequest(Request::GET, $path);
//OPTIMIZE!
// TODO: OPTIMIZE!
$binary = $request->execute();
$stream = fopen('php://memory', 'rwb+');
fwrite($stream, $binary);
Expand Down Expand Up @@ -493,7 +493,6 @@ public function query(\PHPCR\Query\QueryInterface $query)
return $rows;
}


/**
* checks if the path is absolute, throws an exception if it is not
*
Expand Down Expand Up @@ -582,7 +581,6 @@ public function copyNode($srcAbsPath, $dstAbsPath, $srcWorkspace = null)
$request->execute();
}


/**
* Moves a node from src to dst
*
Expand All @@ -608,7 +606,6 @@ public function cloneFrom($srcWorkspace, $srcAbsPath, $destAbsPath, $removeExist
throw new NotImplementedException();
}


/**
* Recursively store a node and its children to the given absolute path.
*
Expand Down Expand Up @@ -756,15 +753,15 @@ public function storeProperty(\PHPCR\PropertyInterface $property)
protected function propertyToXmlString($value, $type)
{
switch ($type) {
case \PHPCR\PropertyType::TYPENAME_DATE:
return $value->format(\Jackalope\Helper::DATETIME_FORMAT);
case \PHPCR\PropertyType::TYPENAME_BINARY:
return base64_encode(stream_get_contents($value));
case \PHPCR\PropertyType::TYPENAME_UNDEFINED:
case \PHPCR\PropertyType::TYPENAME_STRING:
case \PHPCR\PropertyType::TYPENAME_URI:
$value = str_replace(']]>',']]]]><![CDATA[>',$value);
return '<![CDATA['.$value.']]>';
case \PHPCR\PropertyType::TYPENAME_DATE:
return $value->format(\Jackalope\Helper::DATETIME_FORMAT);
case \PHPCR\PropertyType::TYPENAME_BINARY:
return base64_encode(stream_get_contents($value));
case \PHPCR\PropertyType::TYPENAME_UNDEFINED:
case \PHPCR\PropertyType::TYPENAME_STRING:
case \PHPCR\PropertyType::TYPENAME_URI:
$value = str_replace(']]>',']]]]><![CDATA[>',$value);
return '<![CDATA['.$value.']]>';
}
//FIXME: handle boolean correctly. strings true and false?
return $value;
Expand All @@ -780,12 +777,12 @@ protected function propertyToXmlString($value, $type)
protected function propertyToRawString($value, $type)
{
switch ($type) {
case \PHPCR\PropertyType::TYPENAME_BINARY:
return stream_get_contents($value);
case \PHPCR\PropertyType::TYPENAME_UNDEFINED:
case \PHPCR\PropertyType::TYPENAME_STRING:
case \PHPCR\PropertyType::TYPENAME_URI:
return $value;
case \PHPCR\PropertyType::TYPENAME_BINARY:
return stream_get_contents($value);
case \PHPCR\PropertyType::TYPENAME_UNDEFINED:
case \PHPCR\PropertyType::TYPENAME_STRING:
case \PHPCR\PropertyType::TYPENAME_URI:
return $value;
}
return $this->propertyToXmlString($value, $type);
}
Expand Down

0 comments on commit 60bafe7

Please sign in to comment.