Merge branch 'develop' of github.hpcloud.net:butchema/HPCloud-PHP into develop

This commit is contained in:
Technosophos
2012-09-04 13:21:32 -05:00
30 changed files with 321 additions and 1456 deletions

7
CHANGELOG.md Normal file
View File

@@ -0,0 +1,7 @@
# Release Notes
This changelog contains the relevant feature additions and bug fixes. To obtain a complete diff between versions you can got to https://github.com/hpcloud/HPCloud-PHP/compare/XXX...XXX where the XXX values are two different tagged versions of the library. For example, https://github.com/hpcloud/HPCloud-PHP/compare/1.0.0-beta6...1.0.0
* 1.0.0 (2012-08-09)
* This is the initial stable release for object storage, CDN, and identity services. DBaaS is currently in private beta as such the bindings for this component are still in beta.

View File

@@ -26,9 +26,9 @@ Coming soon:
We also have support for using PHP's native HTTP stream wrapper, but it
is not as reliable. We recommend cURL.
## Warnings
## Versioning
The API for services in beta (e.g., DBaaS) should be considered beta as well.
We have a goal to be as consistent as possible with [Semantic Versioning](http://semver.org/). For released HP Cloud services this is what you can expect. For products in beta expect the included components to be in beta. For example, [HP Cloud Relational Database for MySQL](https://www.hpcloud.com/products/RDB) (our DBaaS offering) is private beta.
## Installation

View File

@@ -1,3 +0,0 @@
%SUMMARY%
%DESCRIPTION%

17
RELEASE
View File

@@ -1,17 +0,0 @@
Release notes for HPCloud-PHP
1.0.0
1.0.0-alpha1
* Added ACL support
* Added ability to update obj metadata without re-submitting the entire
object.
* Added container metadata.
* Added support for setting the following header types:
- Content Disposition
- Content Encoding
- CORS headers
* Added support for server-side copying of objects.
* Added the ability to upload a file straight from a stream, instead of
having to buffer the entire stream into memory.

626
build.xml
View File

@@ -1,626 +0,0 @@
<?xml version="1.0"?>
<project
name="HPCloud-PHP"
description="API for working with HPCloud"
default="longhelp">
<!--
This is the Phing build file for HPCloud-PHP.
Phing is a build tool. Learn more about it at http://phing.info.
Copyright (c) 2011, mattbutcher.
-->
<target name="help" description="Print short help message.">
<echo>
#############
# Basic Usage #
#############
Use Phing to manage this project.
To list all of the available commands, do:
phing -l
To build a release, type:
phing build -Dversion=1.0.0
Leaving -Dversion off will result in a "snapshot" release.
To learn about more options, type
phing longhelp
</echo>
</target>
<target name="longhelp" description="Information on the build system.">
<echo>
############
# THE BASICS #
############
To build HPCloud-PHP, run:
phing build
This will create a complete distribution of the project in /dist, with the build files in /bin/build. Documentation will be generated if the appropriate target is configured.
A versioned release can be built with:
phing build -Dversion=2.1.1alpha1
To see all available build targets, run this command:
phing -l
Check Configuration
===================
To check how your project is configured, use the 'info' target:
phing info
This will print details about the project.
Syntax Check
============
To check the syntax of all of your PHP source code, run this:
phing lint
It will generate a report on any files that fail to parse correctly.
Generating Documentation
========================
To generate docs, do:
phing doc
Documentation will be stored in doc/. You can start with doc/index.html.
Running Unit Tests
==================
To run any configured tests, do:
phing test
The above will generate HTML test results which will be placed in test/reports/. If you wish to run the test and print the results directly the the command line (fast tests), you should run 'phing ftest' instead.
phing ftest
Code Coverage Reports
=====================
To run coverage analysis, do:
phing coverage
This will create HTML pages describing code coverage. The coverage analysis will be available in test/coverage
###################
# OPTIONAL FEATURES #
###################
Phar Packages
=============
This script can produce Phar packages on systems with PHP 5.3:
phing pharBuild
TextMate Integration
====================
If you are a TextMate user, you can install the Phing TextMate bundle
(http://github.com/technosophos/phing-tmbundle) to get some special TextMate features.
Special TextMate keybindings:
CMD-U: Run any target in the build file
CMD-SHIFT-I: Run the tmtest unit test target
CMD-SHIFT-U: Run the tmtarget target, which you can configure to do whatever you want
Pear Channel Support
====================
This script will generate PEAR-compatible packages, provided you configure your settings correctly.
If you use Pirum (http://pirum-project.org) to manage your PEAR channel, you can use the
Phing-Pirum package (http://github.com/technosophos/Phing-Pirum) to build or manage the channel from
these scripts. You need to edit the Pirum configuration in build.xml, though.
Pyrus Support
=============
We are experimenting with supporting Pyrus, the next generation PEAR client. Pyrus can build
packages much more effectively, and supports a wide range of useful commands. Currently, we are
working on two targets:
phing pyrusMake
phing pyrusPackage
========
To print this message, do:
phing longhelp
</echo>
</target>
<property file="project.properties"/>
<!-- IMPORTANT: Project settings. -->
<property name="project.name" value="${phing.project.name}"/>
<property name="project.homepage" value="http://github.com/technosophos/metaphing"/>
<property name="project.summary" value="A PHP project"/>
<property name="project.description">
PHP language bindings for the HP Cloud.
</property>
<property name="project.license" value="MIT License"/>
<property name="project.php.version" value="5.1.0"/>
<property name="project.lead" value="mattbutcher"/>
<property name="project.lead.email" value="someone@example.com"/>
<!-- PEAR-specific settings -->
<property name="pear.version" value="1.4.6"/>
<property name="pear.channel" value="pear.myserver.net"/>
<!-- PhpDocumentor-specific settings. -->
<!-- Documentation style used by PHPDocumentor -->
<property name="phpdoc.style" value="HTML:frames:earthli"/>
<property name="doxygen.config" value="./config.doxy"/>
<!--
If you are using Pirum to manage PEAR channels, install Phing-Pirum
and uncomment this section:
* Includepath only if you didn't install Phing-Pirum from http://pear.querypath.org
* Two taskdefs for Phing Pirum tasks
* A property, pearchannel, setting the location of your PEAR channel.
-->
<!--
<includepath classpath="../Phing-Pirum/src"/>
<taskdef classname="PhingPirum.Task.PirumBuildTask" name="pirumbuild"/>
<taskdef classname="PhingPirum.Task.PirumAddTask" name="pirumadd"/>
<property name="pearchannel" value="../pear.querypath.org/pear"/>
-->
<includepath classpath="../../PhingDoxygen/src"/>
<taskdef classname="PhingDoxygen.Task.DoxygenTask" name="doxygen"/>
<!-- Pyrus tasks. -->
<includepath classpath="/Users/mbutcher/Code"/> <!-- Pyrus is here. -->
<includepath classpath="../../PhingPyrus/src"/>
<taskdef classname="PhingPyrus.Task.PyrusMakeTask" name="pyrusmake"/>
<taskdef classname="PhingPyrus.Task.PyrusPackageTask" name="pyruspackage"/>
<taskdef classname="PhingPyrus.Task.PyrusHelpTask" name="pyrushelp"/>
<taskdef classname="PhingPyrus.Task.PyrusExecTask" name="pyrusexec"/>
<!-- Directory locations -->
<property name="srcdir" value="${project.basedir}/src"/>
<property name="testdir" value="${project.basedir}/test"/>
<property name="builddir" value="${project.basedir}/bin/build"/>
<property name="docsdir" value="${project.basedir}/doc/api"/>
<property name="packagedir" value="${project.basedir}/dist"/>
<property name="datadir" value="${project.basedir}/data"/>
<property name="exampledir" value="${project.basedir}/examples"/>
<property name="tutorialdir" value="${project.basedir}/tutorials"/>
<!-- If you are writing Phar files, use this for Phar stubs: -->
<property name="phardir" value="${project.basedir}/phar"/>
<!-- ====================================================================
PHING FILE SETS
==================================================================== -->
<!-- Files that must be included in the release -->
<fileset id="licensefiles" dir=".">
<include name="README.md"/>
<include name="INSTALL"/>
<include name="COPYING-MIT.txt"/>
<include name="CREDITS"/>
<include name="README.pear"/>
<include name="RELEASE"/>
<include name="API"/>
</fileset>
<!-- Files to be treated as source code -->
<fileset id="sourcecode" dir="${srcdir}">
<include name="**/*" />
</fileset>
<!-- Unit tests and auxilliary files -->
<fileset id="unittests" dir="${testdir}/Tests">
<include name="**/*Test.php" />
</fileset>
<!-- Examples -->
<fileset id="examplecode" dir="${exampledir}">
<include name="**/*" />
</fileset>
<!-- DocBook Tutorials imported into PhpDocumentor -->
<fileset id="tutorials" dir="${tutorialdir}">
<include name="**/*" />
</fileset>
<!-- Documentation -->
<fileset id="docs" dir="${docsdir}">
<include name="**/*" />
</fileset>
<!-- Data -->
<fileset id="data" dir="${datadir}">
<include name="**/*" />
</fileset>
<!-- ====================================================================
PHING TARGETS
==================================================================== -->
<!-- TARGET
Print useful information and exit.
-->
<target name="info" description="Print information about this project" depends="setup">
<echo>
Project name: ${project.name}
By ${project.lead} (${project.lead.email})
Summary: ${project.summary}
Description: ${project.description}
Source code: ${srcdir}
Complete packages: ${packagedir}
Version string pattern: ${project.name}-dev${DSTAMP}
Edit project.properties (or build.xml) to set the above.
</echo>
</target>
<!-- TARGET
The primary build target.
Runs the following:
* lint
* setup
* prebuild
* docBuild
* fullBuild
-->
<target name="build" depends="lint, setup, prebuild, docBuild, fullBuild"
description="Generate docs, and full build and then creates packages."
>
<!-- Main build target. Calls all dependencies and exits. -->
</target>
<!-- TARGET
Target that should be run always.
-->
<target name="setup" description="Run required configuration for any build.">
<tstamp/>
<!--
Default version.
Note that this is designed to appear to match the PEAR conventions. However,
it uses a date stamp instead of an incrementing integer, making this more suitable
for daily snapshots.
-->
<property name="version" value="dev${DSTAMP}"/>
</target>
<!-- TARGET
Tasks to do before any build.
-->
<target name="prebuild" description="Prepare for building. No need to call directly.">
<mkdir dir="./dist"/>
</target>
<!-- TARGET
Build the full package.
We do this by copying all important components into ${builddir} and then
packaging them all up. Along the way, we create a package.xml file. With a little
tweaking, you can use the distributed package as a PEAR package.
-->
<target name="fullBuild" description="Full ${project.name} build, including docs."
depends="setup,prebuild">
<property name="releasedir" value="${builddir}/${project.name}-${version}" override="true"/>
<delete dir="${releasedir}" />
<!-- Make all necessary directories. -->
<mkdir dir="${releasedir}"/>
<mkdir dir="${releasedir}/data"/>
<mkdir dir="${releasedir}/doc"/>
<mkdir dir="${releasedir}/examples"/>
<mkdir dir="${releasedir}/scripts"/>
<mkdir dir="${releasedir}/src"/>
<mkdir dir="${releasedir}/test"/>
<!-- mkdir dir="${releasedir}/tutorials"/ -->
<!-- Copy license files. -->
<copy todir="${releasedir}">
<filterchain>
<replacetokens begintoken="%" endtoken="%">
<token key="UNSTABLE" value="${version}"/>
<token key="PROJECT" value="${project.name}"/>
<token key="SUMMARY" value="${project.summary}"/>
<token key="DESCRIPTION" value="${project.description}"/>
</replacetokens>
</filterchain>
<fileset refid="licensefiles"/>
</copy>
<!-- Pyrus wants README, not README.pear -->
<copy file="${releasedir}/README.pear" tofile="${releasedir}/README"/>
<!-- Create API and RELEASE files -->
<copy file="${releasedir}/API" tofile="${releasedir}/API-${version}"/>
<copy file="${releasedir}/RELEASE" tofile="${releasedir}/RELEASE-${version}"/>
<!-- Copy source code, doing token replacement on version. -->
<copy todir="${releasedir}/src">
<filterchain>
<replacetokens begintoken="%" endtoken="%">
<token key="UNSTABLE" value="${version}"/>
</replacetokens>
</filterchain>
<fileset refid="sourcecode"/>
</copy>
<!-- Copy examples. -->
<copy todir="${releasedir}/examples">
<fileset refid="examplecode"/>
</copy>
<!-- Copy tests. -->
<copy todir="${releasedir}/tests">
<fileset refid="unittests"/>
</copy>
<!-- Copy tutorials -->
<!--
<copy todir="${releasedir}/tutorials">
<fileset refid="tutorials"/>
</copy>
-->
<!-- Copy documentation -->
<copy todir="${releasedir}/doc">
<fileset refid="docs"/>
</copy>
<!-- Copy data dir -->
<copy todir="${releasedir}/data">
<fileset refid="data"/>
</copy>
<!-- Use Pyrus to create a package. -->
<pyrusmake dir="${releasedir}" packagename="${project.name}" channel="${pear.channel}"/>
<pyruspackage packagexml="${releasedir}/package.xml"/>
<!-- Add the package to the PEAR channel. -->
<move file="./${project.name}-${version}.tgz" tofile="${packagedir}/${project.name}-${version}.tgz"/>
<pirumadd targetdir="${pearchannel}" packagefile="${packagedir}/${project.name}-${version}.tgz"/>
</target>
<!-- TARGET
Check syntax of all source code files.
-->
<target name="lint" description="Check syntax of source.">
<phplint>
<fileset refid="sourcecode" />
</phplint>
</target>
<!-- TARGET
Build documentation.
Run PhpDocumentor to generate the documentation for a site.
-->
<target name="doc" depends="lint,setup" description="Generate API docs.">
<delete dir="${docsdir}"/>
<doxygen config="${doxygen.config}"/>
<!--
During documentation generation, this will replace the string -UNSTABLE% with
the release version ID. You can use this to generate documents with information
about the release they are part of.
-->
<reflexive>
<fileset refid="docs"/>
<filterchain>
<replacetokens begintoken="-" endtoken="%">
<token key="UNSTABLE" value="${version}"/>
<token key="PROJECT" value="${project.name}"/>
<token key="SUMMARY" value="${project.summary}"/>
<token key="DESCRIPTION" value="${project.description}"/>
</replacetokens>
</filterchain>
</reflexive>
</target>
<!-- TARGET
This is the tmtarget for the TextMate Phing package. This allows you to run
your phing builds from inside of TextMate.
To execute this in TextMate, use CMD-SHIFT-I.
See http://github.com/technosophos/phing-tmbundle
To set this to execute different things, simply change depends= to something else.
-->
<target name="tmtarget" depends="info" description="Target for textmate">
<echo>Executed tmtarget in build.xml.</echo>
</target>
<!-- TARGET
Run a fast test and print the results to the console.
-->
<target name="ftest" description="Run a quick unit test." depends="pretest">
<exec command="php mageekguy.atoum.phar -d test/Tests" passthru="true"/>
</target>
<!-- TARGET
Run any necessary preliminaries before executing tests.
-->
<target name="pretest" description="tasks done before any unit testing.">
<mkdir dir="test/reports"/>
<mkdir dir="test/reports/html"/>
</target>
<!-- TARGET
Run unit tests with HTML output optimized for display inside of TextMate.
If you have Phing-TMBundle installed (http://github.com/technosophos/phing-tmbundle) then
you can press CMD-SHIFT-I to run these tests.
-->
<target name="tmtest" description="Run test, optimized for TextMate output." depends="pretest">
<phpunit>
<formatter todir="test/reports" type="xml" usefile="yes"/>
<batchtest>
<fileset refid="unittests"/>
</batchtest>
</phpunit>
<phpunitreport
infile="test/reports/testsuites.xml"
format="noframes"
todir="test/reports/html"
/>
</target>
<!-- TARGET
Run a coverage report.
Run a report to determine to what extent your code has been covered by the unit tests.
-->
<target name="coverage" depends="lint" description="Run a coverage analysis.">
<coverage-setup database="./test/db/coverage.db">
<fileset refid="sourcecode"/>
</coverage-setup>
<phpunit codecoverage="true" haltonfailure="true">
<formatter type="plain" todir="test/reports" outfile="coverage.xml"/>
<batchtest>
<fileset dir="test/Tests">
<include name="**/*Test.php"/>
</fileset>
</batchtest>
</phpunit>
<coverage-report outfile="test/reports/coverage.xml">
<report todir="test/coverage"/>
</coverage-report>
</target>
<!-- TARGET
Run a full test and format an HTML report.
This differs from tmtest in that the output for this report is more robust, designed for
detailed viewing, not viewing quickly in a pop-up window.
-->
<target name="test" depends="lint,pretest" description="Run full tests">
<mkdir dir="test/reports/html"/>
<mkdir dir="test/db"/>
<phpunit>
<formatter todir="test/reports" type="xml"/>
<batchtest>
<fileset dir="test/Tests">
<include name="**/*Test.php"/>
</fileset>
</batchtest>
</phpunit>
<phpunitreport
infile="test/reports/testsuites.xml"
format="frames"
todir="test/reports/html"
/>
</target>
<!-- TARGET
Build a documentation-only package.
This just runs the 'doc' target and then packages the output into a tar and a zip file.
-->
<target name="docBuild" description="Build a package containing just docs."
depends="setup,prebuild,doc">
<property name="releasedir" value="${builddir}/${project.name}-${version}-docs"/>
<delete dir="${releasedir}" />
<!-- Make all necessary directories. -->
<mkdir dir="${releasedir}"/>
<!-- Copy license files. -->
<copy todir="${releasedir}">
<fileset refid="licensefiles"/>
</copy>
<!-- Copy documentation -->
<copy todir="${releasedir}/doc">
<fileset refid="docs"/>
</copy>
<!-- Create tgz and zip versions. -->
<tar destfile="${packagedir}/${project.name}-${version}-docs.tgz" compression="gzip">
<fileset dir="${builddir}">
<include name="${project.name}-${version}-docs/**/*"/>
</fileset>
</tar>
<zip destfile="${packagedir}/${project.name}-${version}-docs.zip" basedir="${releasedir}"/>
</target>
<!-- TARGET
Build a Phar package.
For PHP 5.3 and up, this is another way of building a release - a much better way.
This target is not called by the default build.
-->
<target name="pharBuild" depends="setup,prebuild" description="Build a Phar package of this project.">
<property name="releasedir" value="${builddir}/${project.name}-${version}-phar" override="true"/>
<echo>${releasedir}</echo>
<delete dir="${releasedir}" />
<mkdir dir="${releasedir}"/>
<copy todir="${releasedir}">
<filterchain>
<stripphpcomments/>
<stripwhitespace/>
<replacetokens begintoken="%" endtoken="%">
<token key="UNSTABLE" value="${version}"/>
<token key="PHAR_FILENAME" value="${project.name}.phar"/>
</replacetokens>
</filterchain>
<fileset dir="${srcdir}">
<include name="**/*"/>
</fileset>
</copy>
<copy todir="${releasedir}">
<fileset refid="licensefiles"/>
</copy>
<pharpackage
destfile="${packagedir}/${project.name}-${version}.phar"
basedir="${releasedir}"
alias="${project.name}.phar">
<!-- stub="${releasedir}/basic_loader.php" -->
<fileset dir="${releasedir}">
<include name="**/**"/>
</fileset>
<metadata>
<element name="version" value="${version}" />
<element name="authors">
<element name="${project.lead}">
<element name="e-mail" value="${project.lead.email}" />
</element>
</element>
</metadata>
</pharpackage>
</target>
</project>

View File

@@ -1,751 +0,0 @@
<?xml version="1.0"?>
<project
name="HPCloud-PHP"
description="A PHP project"
default="longhelp">
<!--
This is the Phing build file for HPCloud-PHP.
THIS BUILD FILE SHOWS EXAMPLES USING BUILT-IN Phing COMMANDS.
Phing is a build tool. Learn more about it at http://phing.info.
Copyright (c) 2011, mattbutcher.
-->
<target name="help" description="Print short help message.">
<echo>
#############
# Basic Usage #
#############
Use Phing to manage this project.
To list all of the available commands, do:
phing -l
To build a release, type:
phing build -Dversion=1.0.0
Leaving -Dversion off will result in a "snapshot" release.
To learn about more options, type
phing longhelp
</echo>
</target>
<target name="longhelp" description="Information on the build system.">
<echo>
############
# THE BASICS #
############
To build HPCloud-PHP, run:
phing build
This will create a complete distribution of the project in /dist, with the build files in /bin/build. Documentation will be generated if the appropriate target is configured.
A versioned release can be built with:
phing build -Dversion=2.1.1alpha1
To see all available build targets, run this command:
phing -l
Check Configuration
===================
To check how your project is configured, use the 'info' target:
phing info
This will print details about the project.
Syntax Check
============
To check the syntax of all of your PHP source code, run this:
phing lint
It will generate a report on any files that fail to parse correctly.
Generating Documentation
========================
To generate docs, do:
phing doc
Documentation will be stored in doc/. You can start with doc/index.html.
Running Unit Tests
==================
To run any configured tests, do:
phing test
The above will generate HTML test results which will be placed in test/reports/. If you wish to run the test and print the results directly the the command line (fast tests), you should run 'phing ftest' instead.
phing ftest
Code Coverage Reports
=====================
To run coverage analysis, do:
phing coverage
This will create HTML pages describing code coverage. The coverage analysis will be available in test/coverage
###################
# OPTIONAL FEATURES #
###################
Phar Packages
=============
This script can produce Phar packages on systems with PHP 5.3:
phing pharBuild
TextMate Integration
====================
If you are a TextMate user, you can install the Phing TextMate bundle
(http://github.com/technosophos/phing-tmbundle) to get some special TextMate features.
Special TextMate keybindings:
CMD-U: Run any target in the build file
CMD-SHIFT-I: Run the tmtest unit test target
CMD-SHIFT-U: Run the tmtarget target, which you can configure to do whatever you want
Pear Channel Support
====================
This script will generate PEAR-compatible packages, provided you configure your settings correctly.
If you use Pirum (http://pirum-project.org) to manage your PEAR channel, you can use the
Phing-Pirum package (http://github.com/technosophos/Phing-Pirum) to build or manage the channel from
these scripts. You need to edit the Pirum configuration in build.xml, though.
Pyrus Support
=============
We are experimenting with supporting Pyrus, the next generation PEAR client. Pyrus can build
packages much more effectively, and supports a wide range of useful commands. Currently, we are
working on two targets:
phing pyrusMake
phing pyrusPackage
========
To print this message, do:
phing longhelp
</echo>
</target>
<property file="project.properties"/>
<!-- IMPORTANT: Project settings. -->
<property name="projectname" value="HPCloud-PHP"/>
<property name="project.homepage" value="http://github.com/technosophos/metaphing"/>
<property name="project.summary" value="A PHP project"/>
<property name="project.description">
This is a useful PHP project.
</property>
<property name="project.license" value="MIT License"/>
<property name="project.php.version" value="5.1.0"/>
<property name="project.lead" value="mattbutcher"/>
<property name="project.lead.email" value="someone@example.com"/>
<!-- PEAR-specific settings -->
<property name="pear.version" value="1.4.6"/>
<property name="pear.channel" value="pear.myserver.net"/>
<!-- PhpDocumentor-specific settings. -->
<!-- Documentation style used by PHPDocumentor -->
<property name="phpdoc.style" value="HTML:frames:earthli"/>
<property name="doxygen.config" value="./config.doxy"/>
<!--
If you are using Pirum to manage PEAR channels, install Phing-Pirum
and uncomment this section:
* Includepath only if you didn't install Phing-Pirum from http://pear.querypath.org
* Two taskdefs for Phing Pirum tasks
* A property, pearchannel, setting the location of your PEAR channel.
-->
<!--
<includepath classpath="../Phing-Pirum/src"/>
<taskdef classname="PhingPirum.Task.PirumBuildTask" name="pirumbuild"/>
<taskdef classname="PhingPirum.Task.PirumAddTask" name="pirumadd"/>
<property name="pearchannel" value="../pear.querypath.org/pear"/>
-->
<includepath classpath="../PhingDoxygen/src"/>
<taskdef classname="PhingDoxygen.Task.DoxygenTask" name="doxygen"/>
<!-- Pyrus tasks. -->
<includepath classpath="/Users/mbutcher/Code"/> <!-- Pyrus is here. -->
<includepath classpath="../PhingPyrus/src"/>
<taskdef classname="PhingPyrus.Task.PyrusMakeTask" name="pyrusmake"/>
<taskdef classname="PhingPyrus.Task.PyrusPackageTask" name="pyruspackage"/>
<taskdef classname="PhingPyrus.Task.PyrusHelpTask" name="pyrushelp"/>
<taskdef classname="PhingPyrus.Task.PyrusExecTask" name="pyrusexec"/>
<!-- Directory locations -->
<property name="srcdir" value="./src"/>
<property name="testdir" value="./test"/>
<property name="builddir" value="./bin/build"/>
<property name="docsdir" value="./doc/api"/>
<property name="packagedir" value="./dist"/>
<property name="datadir" value="./data"/>
<property name="exampledir" value="./examples"/>
<property name="tutorialdir" value="./tutorials"/>
<!-- If you are writing Phar files, use this for Phar stubs: -->
<property name="phardir" value="./phar"/>
<!-- ====================================================================
PHING FILE SETS
==================================================================== -->
<!-- Files that must be included in the release -->
<fileset id="licensefiles" dir=".">
<include name="README.md"/>
<include name="INSTALL"/>
<include name="COPYING-MIT.txt"/>
<include name="CREDITS"/>
<include name="README.pear"/>
<include name="RELEASE"/>
<include name="API"/>
</fileset>
<!-- Files to be treated as source code -->
<fileset id="sourcecode" dir="${srcdir}">
<include name="**/*" />
</fileset>
<!-- Unit tests and auxilliary files -->
<fileset id="unittests" dir="${testdir}/Tests">
<include name="**/*Test.php" />
</fileset>
<!-- Examples -->
<fileset id="examplecode" dir="${exampledir}">
<include name="**/*" />
</fileset>
<!-- DocBook Tutorials imported into PhpDocumentor -->
<fileset id="tutorials" dir="${tutorialdir}">
<include name="**/*" />
</fileset>
<!-- Documentation -->
<fileset id="docs" dir="${docsdir}">
<include name="**/*" />
</fileset>
<!-- Data -->
<fileset id="data" dir="${datadir}">
<include name="**/*" />
</fileset>
<!-- ====================================================================
PHING TARGETS
==================================================================== -->
<!-- TARGET
Print useful information and exit.
-->
<target name="info" description="Print information about this project" depends="setup">
<echo>
Project name: ${projectname}
By ${project.lead} (${project.lead.email})
Summary: ${project.summary}
Description: ${project.description}
Source code: ${srcdir}
Complete packages: ${packagedir}
Version string pattern: ${projectname}-dev${DSTAMP}
Edit project.properties (or build.xml) to set the above.
</echo>
</target>
<!-- TARGET
The primary build target.
Runs the following:
* lint
* setup
* prebuild
* docBuild
* fullBuild
-->
<target name="build" depends="lint, setup, prebuild, docBuild, fullBuild"
description="Generate docs, and full build and then creates packages."
>
<!-- Main build target. Calls all dependencies and exits. -->
</target>
<!-- TARGET
Target that should be run always.
-->
<target name="setup" description="Run required configuration for any build.">
<tstamp/>
<!--
Default version.
Note that this is designed to appear to match the PEAR conventions. However,
it uses a date stamp instead of an incrementing integer, making this more suitable
for daily snapshots.
-->
<property name="version" value="dev${DSTAMP}"/>
</target>
<!-- TARGET
Tasks to do before any build.
-->
<target name="prebuild" description="Prepare for building. No need to call directly.">
<mkdir dir="./dist"/>
</target>
<!-- TARGET
Build the full package.
We do this by copying all important components into ${builddir} and then
packaging them all up. Along the way, we create a package.xml file. With a little
tweaking, you can use the distributed package as a PEAR package.
-->
<target name="fullBuild" description="Full ${projectname} build, including docs."
depends="setup,prebuild,setPearStability">
<property name="releasedir" value="${builddir}/${projectname}-${version}" override="true"/>
<delete dir="${releasedir}" />
<!-- Make all necessary directories. -->
<mkdir dir="${releasedir}"/>
<mkdir dir="${releasedir}/data"/>
<mkdir dir="${releasedir}/doc"/>
<mkdir dir="${releasedir}/examples"/>
<mkdir dir="${releasedir}/scripts"/>
<mkdir dir="${releasedir}/src"/>
<mkdir dir="${releasedir}/test"/>
<!-- mkdir dir="${releasedir}/tutorials"/ -->
<!-- Copy license files. -->
<copy todir="${releasedir}">
<filterchain>
<replacetokens begintoken="%" endtoken="%">
<token key="UNSTABLE" value="${version}"/>
<token key="PROJECT" value="${projectname}"/>
<token key="SUMMARY" value="${project.summary}"/>
<token key="DESCRIPTION" value="${project.description}"
</replacetokens>
</filterchain>
<fileset refid="licensefiles"/>
</copy>
<!-- Pyrus wants README, not README.md -->
<copy file="${releasedir}/README.pear" tofile="${releasedir}/README"/>
<!-- Create API and RELEASE files -->
<copy file="{$releasedir}/API" tofile="${releasedir}/API-${version}"/>
<copy file="{$releasedir}/API" tofile="${releasedir}/RELEASE-${version}"/>
<!-- Copy source code, doing token replacement on version. -->
<copy todir="${releasedir}/src">
<filterchain>
<replacetokens begintoken="%" endtoken="%">
<token key="UNSTABLE" value="${version}"/>
</replacetokens>
</filterchain>
<fileset refid="sourcecode"/>
</copy>
<!-- Copy examples. -->
<copy todir="${releasedir}/examples">
<fileset refid="examplecode"/>
</copy>
<!-- Copy tests. -->
<copy todir="${releasedir}/tests">
<fileset refid="unittests"/>
</copy>
<!-- Copy tutorials -->
<!--
<copy todir="${releasedir}/tutorials">
<fileset refid="tutorials"/>
</copy>
-->
<!-- Copy documentation -->
<copy todir="${releasedir}/doc">
<fileset refid="docs"/>
</copy>
<!-- Copy data dir -->
<copy todir="${releasedir}/data">
<fileset refid="data"/>
</copy>
<!-- Alternate toolchain: Use Pyrus and Pirum to create a package. -->
<!--
<pyrusmake dir="${releasedir}" packagename="${projectname}" channel="${pear.channel}"/>
<pyruspackage packagexml="${releasedir}/package.xml"/>
<move file="./${projectname}-${version}.tgz" tofile="${packagedir}/${projectname}-${version}.tgz"/>
<pirumadd targetdir="${pearchannel}" packagefile="${packagedir}/${projectname}-${version}.tgz"/>
-->
<!-- Create a PEAR package.xml file -->
<pearpkg2 name="${projectname}" dir="./">
<fileset dir="${releasedir}">
<include name="**/**"/>
</fileset>
<option name="uri" value="${project.homepage}"/>
<option name="packagefile" value="package2.xml"/>
<option name="channel" value="${pear.channel}"/>
<option name="baseinstalldir" value="${projectname}"/>
<option name="summary" value="${project.summary}"/>
<option name="description" value="${project.description}"/>
<option name="apiversion" value="${version}"/>
<option name="apistability" value="${stability}"/>
<option name="releaseversion" value="${version}"/>
<option name="releasestability" value="${stability}"/>
<option name="license" value="${project.license}"/>
<option name="phpdep" value="${project.php.version}"/>
<option name="pearinstallerdep" value="${pear.version}"/>
<option name="packagetype" value="php"/>
<option name="notes" value="This package was built automatically by Phing/MetaPhing"/>
<option name="outputdirectory" value="./${builddir}"/>
<option name="packagedirectory" value="./${releasedir}"/>
<mapping name="maintainers">
<element>
<element key="handle" value="${project.lead}"/>
<element key="name" value="${project.lead}"/>
<element key="email" value="${project.lead.email}"/>
<element key="role" value="lead"/>
</element>
</mapping>
</pearpkg2>
<!-- Move the package.xml to the releasedir -->
<move file="${builddir}/package2.xml" tofile="${packagedir}/package.xml"/>
<!-- Create Gzipped Tar file that acts like a PEAR package. This will be put in dist/ -->
<tar destfile="${packagedir}/${projectname}-${version}.tgz" compression="gzip">
<fileset dir="${builddir}">
<include name="${projectname}-${version}/**/*"/>
<include name="package.xml"/>
</fileset>
</tar>
<!-- Create a ZIP version which is NOT a PEAR package. Put in dist/. -->
<zip destfile="${packagedir}/${projectname}-${version}.zip" basedir="${releasedir}"/>
</target>
<!-- TARGET
Check syntax of all source code files.
-->
<target name="lint" description="Check syntax of source.">
<phplint>
<fileset refid="sourcecode" />
</phplint>
</target>
<!-- TARGET
Build documentation.
Run PhpDocumentor to generate the documentation for a site.
-->
<target name="doc" depends="lint,setup" description="Generate API docs.">
<delete dir="${docsdir}"/>
<doxygen config="${doxygen.config}"/>
<!--
<phpdoc title="${projectname} ${version}"
sourcecode="yes"
destdir="${docsdir}"
output="${phpdoc.style}"
defaultcategoryname="${projectname}"
defaultpackagename="${projectname}"
examplesdir="examples"
quiet="true"
>
<fileset refid="sourcecode"/>
<fileset refid="tutorials"/>
<fileset refid="examplecode"/>
<projdocfileset dir=".">
<include name="README.md"/>
<include name="README"/>
<include name="INSTALL"/>
<include name="COPYING-MIT.txt"/>
<include name="RELEASE-*"/>
<include name="API-*"/>
</projdocfileset>
</phpdoc>
-->
<!--
During documentation generation, this will replace the string @UNSTABLE@ with
the release version ID. You can use this to generate documents with information
about the release they are part of.
-->
<reflexive>
<fileset refid="docs"/>
<filterchain>
<replacetokens begintoken="%" endtoken="%">
<token key="UNSTABLE" value="${version}"/>
<token key="PROJECT" value="${projectname}"/>
<token key="SUMMARY" value="${project.summary}"/>
<token key="DESCRIPTION" value="${project.description}"
</replacetokens>
</filterchain>
</reflexive>
</target>
<!-- TARGET
This is the tmtarget for the TextMate Phing package. This allows you to run
your phing builds from inside of TextMate.
To execute this in TextMate, use CMD-SHIFT-I.
See http://github.com/technosophos/phing-tmbundle
To set this to execute different things, simply change depends= to something else.
-->
<target name="tmtarget" depends="info" description="Target for textmate">
<echo>Executed tmtarget in build.xml.</echo>
</target>
<!-- TARGET
Run a fast test and print the results to the console.
-->
<target name="ftest" description="Run a quick unit test." depends="pretest">
<!-- Fast test. -->
<phpunit>
<formatter type="summary" usefile="no"/>
<batchtest>
<fileset refid="unittests"/>
</batchtest>
</phpunit>
</target>
<!-- TARGET
Run any necessary preliminaries before executing tests.
-->
<target name="pretest" description="tasks done before any unit testing.">
<mkdir dir="test/reports"/>
<mkdir dir="test/reports/html"/>
</target>
<!-- TARGET
Run unit tests with HTML output optimized for display inside of TextMate.
If you have Phing-TMBundle installed (http://github.com/technosophos/phing-tmbundle) then
you can press CMD-SHIFT-I to run these tests.
-->
<target name="tmtest" description="Run test, optimized for TextMate output." depends="pretest">
<phpunit>
<formatter todir="test/reports" type="xml" usefile="yes"/>
<batchtest>
<fileset refid="unittests"/>
</batchtest>
</phpunit>
<phpunitreport
infile="test/reports/testsuites.xml"
format="noframes"
todir="test/reports/html"
/>
</target>
<!-- TARGET
Run a coverage report.
Run a report to determine to what extent your code has been covered by the unit tests.
-->
<target name="coverage" depends="lint" description="Run a coverage analysis.">
<coverage-setup database="./test/db/coverage.db">
<fileset refid="sourcecode"/>
</coverage-setup>
<phpunit codecoverage="true" haltonfailure="true">
<formatter type="plain" todir="test/reports" outfile="coverage.xml"/>
<batchtest>
<fileset dir="test/Tests">
<include name="**/*Test.php"/>
</fileset>
</batchtest>
</phpunit>
<coverage-report outfile="test/reports/coverage.xml">
<report todir="test/coverage"/>
</coverage-report>
</target>
<!-- TARGET
Run a full test and format an HTML report.
This differs from tmtest in that the output for this report is more robust, designed for
detailed viewing, not viewing quickly in a pop-up window.
-->
<target name="test" depends="lint,pretest" description="Run full tests">
<mkdir dir="test/reports/html"/>
<mkdir dir="test/db"/>
<phpunit>
<formatter todir="test/reports" type="xml"/>
<batchtest>
<fileset dir="test/Tests">
<include name="**/*Test.php"/>
</fileset>
</batchtest>
</phpunit>
<phpunitreport
infile="test/reports/testsuites.xml"
format="frames"
todir="test/reports/html"
/>
</target>
<!-- TARGET
Build a documentation-only package.
This just runs the 'doc' target and then packages the output into a tar and a zip file.
-->
<target name="docBuild" description="Build a package containing just docs."
depends="setup,prebuild,doc">
<property name="releasedir" value="${builddir}/${projectname}-${version}-docs"/>
<delete dir="${releasedir}" />
<!-- Make all necessary directories. -->
<mkdir dir="${releasedir}"/>
<!-- Copy license files. -->
<copy todir="${releasedir}">
<fileset refid="licensefiles"/>
</copy>
<!-- Copy documentation -->
<copy todir="${releasedir}/doc">
<fileset refid="docs"/>
</copy>
<!-- Create tgz and zip versions. -->
<tar destfile="${packagedir}/${projectname}-${version}-docs.tgz" compression="gzip">
<fileset dir="${builddir}">
<include name="${projectname}-${version}-docs/**/*"/>
</fileset>
</tar>
<zip destfile="${packagedir}/${projectname}-${version}-docs.zip" basedir="${releasedir}"/>
</target>
<!-- TARGET
Build a Phar package.
For PHP 5.3 and up, this is another way of building a release - a much better way.
This target is not called by the default build.
-->
<target name="pharBuild" depends="setup,prebuild" description="Build a Phar package of this project.">
<property name="releasedir" value="${builddir}/${projectname}-${version}-phar" override="true"/>
<echo>${releasedir}</echo>
<delete dir="${releasedir}" />
<mkdir dir="${releasedir}"/>
<copy todir="${releasedir}">
<filterchain>
<stripphpcomments/>
<stripwhitespace/>
<replacetokens begintoken="@" endtoken="@">
<token key="UNSTABLE" value="${version}"/>
<token key="PHAR_FILENAME" value="${projectname}.phar"/>
</replacetokens>
</filterchain>
<fileset dir="${srcdir}">
<include name="**/*"/>
</fileset>
</copy>
<copy todir="${releasedir}">
<fileset refid="licensefiles"/>
</copy>
<pharpackage
destfile="${packagedir}/${projectname}-${version}.phar"
basedir="${releasedir}"
alias="${projectname}.phar">
<!-- stub="${releasedir}/basic_loader.php" -->
<fileset dir="${releasedir}">
<include name="**/**"/>
</fileset>
<metadata>
<element name="version" value="${version}" />
<element name="authors">
<element name="${project.lead}">
<element name="e-mail" value="${project.lead.email}" />
</element>
</element>
</metadata>
</pharpackage>
</target>
<!-- TARGET
Use Pyrus to generate package.xml files.
-->
<target name="pyrusMake" depends="setup,prebuild" description="EXPERIMENTAL: Use Pyrus to generate a package.xml file from this project.">
</target>
<!-- TARGET
Use Pyrus to create a PEAR package.
-->
<target name="pyrusPackage" depends="setup,prebuild" description="EXPERIMENTAL: Use Pyrus to generate a PEAR package.">
</target>
<!-- TARGET
Release code to a PEAR channel.
-->
<!--
<target name="release" depends="build">
<property name="pirumdir" value="${pearchannel}"/>
<pirumbuild targetdir="${pirumdir}"/>
<pirumadd targetdir="${pirumdir}" packagefile="${packagedir}/${packagename}-${version}.tgz"/>
</target>
-->
<target name="setPearStability" depends="setup">
<property name="stability">stable</property>
<if>
<contains string="${version}" substring="dev"/>
<then>
<property name="stability" override="true">snapshot</property>
</then>
<elseif>
<contains string="${version}" substring="alpha"/>
<then>
<property name="stability" override="true">alpha</property>
</then>
</elseif>
<elseif>
<contains string="${version}" substring="beta"/>
<then>
<property name="stability" override="true">beta</property>
</then>
</elseif>
</if>
<echo>${stability}</echo>
</target>
</project>

View File

@@ -9,6 +9,10 @@
{
"name": "M Butcher",
"email": "matthew.butcher@hp.com"
},
{
"name": "Matt Farina",
"email": "matthew.farina@hp.com"
}
],
"require": {

View File

@@ -1,37 +0,0 @@
# Project build properties for HPCloud-PHP
#
# You can set your project-wide settings here.
#
# This file has some of the common properties -- the ones we think you probably
# want to change -- declared here. There are other available properties at the
# top of the build.xml file.
# The name of the project. Alpha-Num and underscores allowed. NO SPACES.
#project.name=HPCloud-PHP
# Where people can go to learn more about this project.
project.homepage=http://github.com/hpcloud
# A short phrase describing this project.
project.summary=PHP API for HP Cloud
# Technical description of this project.
project.description=Provides an API for working with the HP Cloud
# The name of the license under which this is released.
project.license=MIT License
# The minimal PHP version required to run this project.
project.php.version=5.3.1
# Name and email of the "lead developer" of this project.
project.lead=technosophos
project.lead.email=matthew.butcher@hp.com
# If you are building PEAR packages, set this.
# (By default, our tgz files are PEAR packages)
pear.channel=pear.hpcloud.com
# If you are using PhpDocumentor for documentation, set the output format
# using this.
phpdoc.style=HTML:frames:earthli

View File

@@ -285,6 +285,7 @@ class Bootstrap {
* @param mixed $default
* The default value to return if the name is not found.
* @retval mixed
* @return mixed
* The value, if found; or the default, if set; or NULL.
*/
public static function config($name = NULL, $default = NULL) {
@@ -315,6 +316,7 @@ class Bootstrap {
* @param string $name
* The name of the item to check for.
* @retval boolean
* @return boolean
* TRUE if the named option is set, FALSE otherwise. Note that the value may
* be falsey (FALSE, 0, etc.), but if the value is NULL, this will return
* false.
@@ -333,6 +335,7 @@ class Bootstrap {
* Whether to force the generation of a new object even if one is already
* cached.
* @retval HPCloud::Services::IdentityService
* @return \HPCloud\Services\:IdentityService
* An authenticated ready to use HPCloud::Services::IdentityService object.
* @throws HPCloud::Exception
* When the needed configuration to authenticate is not available.

View File

@@ -137,6 +137,7 @@ class DBaaS {
* Get the project ID for this session.
*
* @retval string
* @return string
* The project ID.
*/
public function projectId() {
@@ -147,6 +148,7 @@ class DBaaS {
* Get the endpoint URL to the DBaaS session.
*
* @retval string
* @return string
* The URL.
*/
public function url() {

View File

@@ -79,7 +79,8 @@ class Instance extends Operations {
*- medium
* @param array $typeSpec
* A typespec array. Currently, only 'mysql', '5.5' is supported.
* @retval object HPCloud::Services::DBaaS::InstanceDetails
* @retval HPCloud::Services::DBaaS::InstanceDetails
* @return \HPCloud\Services\DBaaS\InstanceDetails
* The details of creation, including login and password info.
* @see http://api-docs.hpcloud.com/hpcloud-dbaas/1.0/content/instance-create.html
*/
@@ -132,6 +133,7 @@ class Instance extends Operations {
* Reset the primary password on this instance.
*
* @retval string
* @return string
* The new (autogenerated) password.
*/
public function resetPassword($instanceId) {

View File

@@ -74,6 +74,7 @@ class InstanceDetails {
* Get the name of this instance.
*
* @retval string
* @return string
* The name of the instance.
*/
public function name() {
@@ -84,6 +85,7 @@ class InstanceDetails {
* Get the ID of the instance.
*
* @retval string
* @return string
* The ID.
*/
public function id() {
@@ -96,6 +98,7 @@ class InstanceDetails {
* This may only be set during CREATE or DESCRIBE results.
*
* @retval string
* @return string
* A string indicating the creation time.
* Format is in ISO date format.
*/
@@ -115,6 +118,7 @@ class InstanceDetails {
*- restarting: Instance has been restarted, and is still coming online.
*
* @retval string
* @return string
* A short status message.
*/
public function status() {
@@ -129,6 +133,7 @@ class InstanceDetails {
* checking that status() returns 'running'.
*
* @retval boolean
* @return boolean
* TRUE if this is running, FALSE otherwise.
*/
public function isRunning() {
@@ -148,6 +153,7 @@ class InstanceDetails {
* This returns the DNS name of the host (or possibly an IP address).
*
* @retval string
* @return string
* The FQDN or IP address of the MySQL server.
*/
public function hostname() {
@@ -177,6 +183,7 @@ class InstanceDetails {
* Typically this is only available at creation time!
*
* @retval string
* @return string
* The username for the MySQL instance.
*/
public function username() {
@@ -208,6 +215,7 @@ class InstanceDetails {
* This is only returned when a database is first created.
*
* @retval string
* @return string
* A password string.
*/
public function password() {
@@ -250,6 +258,7 @@ class InstanceDetails {
* definition.
*
* @retval array
* @return array
* An array of related links to DBaaS URLs.
*/
public function links() {
@@ -271,6 +280,7 @@ class InstanceDetails {
* of PHP use this.
*
* @retval string
* @return string
* The DSN, including driver, host, port, and database name.
* @todo
* At this time, 'mysql' is hard-coded as the driver name. Does this

View File

@@ -66,6 +66,7 @@ class Snapshot extends Operations {
* An optional database instance ID. If set, only snapshots for
* the given instance will be returned.
* @retval array
* @return array
* An array of HPCloud::Services::DBaaS::SnapshotDetails
* instances.
*/
@@ -102,7 +103,8 @@ class Snapshot extends Operations {
* A human-readable name for the snapshot. Internally,
* a snapshot ID will be used to reference this
* snapshot.
* @retval object HPCloud::Services::DBaaS::SnapshotDetails
* @retval HPCloud::Services::DBaaS::SnapshotDetails
* @return \HPCloud\Services\DBaaS\SnapshotDetails
* A snapshot details object containing information about
* the snapshot.
*/
@@ -130,6 +132,7 @@ class Snapshot extends Operations {
* The snapshot ID for the snapshot that should
* be deleted.
* @retval boolean
* @return boolean
* Returns boolean TRUE on success. Throws one of the
* HPCloud::Exception instances on failure.
* @throws HPCloud::Exception
@@ -148,7 +151,8 @@ class Snapshot extends Operations {
* @param string $snapshotId
* The snapshot ID.
*
* @retval object HPCloud::Services::DBaaS::SnapshotDetails
* @retval HPCloud::Services::DBaaS::SnapshotDetails
* @return \HPCloud\Services\DBaaS\SnapshotDetails
* The details object.
*/
public function describe($snapshotId) {

View File

@@ -54,6 +54,7 @@ class SnapshotDetails {
* The ID of the snapshot.
*
* @retval string
* @return string
* The ID.
*/
public function id() {
@@ -66,6 +67,7 @@ class SnapshotDetails {
* is a snapshot.
*
* @retval string
* @return string
* The database instance ID.
*/
public function instanceId() {
@@ -75,6 +77,7 @@ class SnapshotDetails {
* The data upon which this snapshot was created.
*
* @retval string
* @return string
* An ISO data string representing the date and time
* that this snapshot was created.
*/
@@ -90,6 +93,7 @@ class SnapshotDetails {
* The data returned from this may be in flux during the beta release
* of this product.
* @retval array
* @return array
* An array of links. Typically, at least an URL to the snapshot should
* be provided.
*/

View File

@@ -223,6 +223,7 @@ class IdentityServices /*implements Serializable*/ {
* URL to the one passed into the constructor.
*
* @retval string
* @return string
* The complete URL to the identity services endpoint.
*/
public function url() {
@@ -258,6 +259,7 @@ class IdentityServices /*implements Serializable*/ {
* An associative array of authentication operations and their respective
* parameters.
* @retval string
* @return string
* The token. This is returned for simplicity. The full response is used
* to populate this object's service catalog, etc. The token is also
* retrievable with token().
@@ -383,6 +385,7 @@ class IdentityServices /*implements Serializable*/ {
* The tenant Name for this account. This can be obtained through the
* HPCloud console.
* @retval string
* @return string
* The auth token.
* @throws HPCloud::Transport::AuthorizationException
* If authentication failed.
@@ -416,6 +419,7 @@ class IdentityServices /*implements Serializable*/ {
* methods has been run.
*
* @retval string
* @return string
* The token ID to be used in subsequent calls.
*/
public function token() {
@@ -432,6 +436,7 @@ class IdentityServices /*implements Serializable*/ {
* run.
*
* @retval string
* @return string
* The tenant ID if available, or NULL.
*/
public function tenantId() {
@@ -450,6 +455,7 @@ class IdentityServices /*implements Serializable*/ {
* run.
*
* @retval string
* @return string
* The tenant name if available, or NULL.
*/
public function tenantName() {
@@ -484,6 +490,7 @@ class IdentityServices /*implements Serializable*/ {
* This will not be populated until after authentication has been done.
*
* @retval array
* @return array
* An associative array of details.
*/
public function tokenDetails() {
@@ -498,6 +505,7 @@ class IdentityServices /*implements Serializable*/ {
* mis-configured machine timestamp could give spurious results.
*
* @retval boolean
* @return boolean
* This will return FALSE if there is a current token and it has
* not yet expired (according to the date info). In all other cases
* it returns TRUE.
@@ -581,6 +589,7 @@ class IdentityServices /*implements Serializable*/ {
* @todo Paging on the service catalog is not yet implemented.
*
* @retval array
* @return array
* An associative array representing
* the service catalog.
*/
@@ -628,6 +637,7 @@ class IdentityServices /*implements Serializable*/ {
* This will not have data until after authentication has been done.
*
* @retval array
* @return array
* An associative array, as described above.
*/
public function user() {
@@ -661,6 +671,7 @@ class IdentityServices /*implements Serializable*/ {
* Note that this method invokes a new request against the remote server.
*
* @retval array
* @return array
* An indexed array of tenant info. Each entry will be an associative
* array containing tenant details.
* @throws HPCloud::Transport::AuthorizationException
@@ -723,6 +734,7 @@ class IdentityServices /*implements Serializable*/ {
* ID will be removed.
*
* @retval string
* @return string
* The authentication token.
* @throws HPCloud::Transport::AuthorizationException
* If authentication failed.
@@ -780,6 +792,7 @@ class IdentityServices /*implements Serializable*/ {
* name will be removed.
*
* @retval string
* @return string
* The authentication token.
* @throws HPCloud::Transport::AuthorizationException
* If authentication failed.
@@ -822,6 +835,10 @@ class IdentityServices /*implements Serializable*/ {
*
* @param object $response HPCloud::Transport::Response
* A response object.
*
* @retval HPCloud::Services::IdentityServices
* @return \HPCloud\Services\IdentityServices
* $this for the current object so it can be used in chaining.
*/
protected function handleResponse($response) {
$json = json_decode($response->content(), TRUE);
@@ -830,6 +847,8 @@ class IdentityServices /*implements Serializable*/ {
$this->tokenDetails = $json['access']['token'];
$this->userDetails = $json['access']['user'];
$this->serviceCatalog = $json['access']['serviceCatalog'];
return $this;
}
/* Not necessary.

View File

@@ -149,7 +149,9 @@ class CDN {
*
* @param HPCloud::Services::IdentityServices $identity
* The identity to use.
* @retval object
* @retval boolean
* @retval HPCloud::Storage::CDN
* @return \HPCloud\Storage\CDN|boolean
* A CDN object or FALSE if no CDN services could be found
* in the catalog.
*/
@@ -195,7 +197,9 @@ class CDN {
* A service catalog; see HPCloud::Services::IdentityServices::serviceCatalog().
* @param string $token
* The token.
* @retval object
* @retval boolean
* @retval HPCloud::Storage::CDN
* @return boolean|\HPCloud\Storage\CDN
* A CDN object or FALSE if no CDN services could be found
* in the catalog.
*/
@@ -305,6 +309,7 @@ class CDN {
* If this is set to TRUE, then only containers that are
* CDN-enabled will be returned.
* @retval array
* @return array
* An indexed array of associative arrays. The format of each
* associative array is explained on container().
* @throws HPCloud::Exception
@@ -357,6 +362,7 @@ class CDN {
* @param string $name
* The name of the container to fetch.
* @retval array
* @return array
* An associative array in the exact format as in containers.
*/
public function container($name) {
@@ -412,6 +418,7 @@ class CDN {
* If this is passed, then its value will be set to TRUE if the
* container was created in the CDN, or FALSE if the container
* already existed in CDN.
* @retval string
* @return string
* TRUE if the container was created, FALSE if the container was already
* added to the CDN (and thus nothing happened).
@@ -450,6 +457,7 @@ class CDN {
* @param array $attrs
* An associative array of attributes.
* @retval boolean
* @return boolean
* TRUE if the update was successful.
* @throws HPCloud::Exception
* Possibly throws one of the HTTP exceptions.
@@ -509,6 +517,7 @@ class CDN {
* @param string $name
* The name of the container whose cache should be suspended.
* @retval boolean
* @return boolean
* TRUE if the container is disabled.
* @throws HPCloud::Exception
* HTTP exceptions may be thrown if an error occurs.
@@ -535,6 +544,7 @@ class CDN {
* @param string $name
* The Container name.
* @retval boolean
* @return boolean
* TRUE if the container was successfully deleted,
* FALSE if the container was not removed, but no
* error occurred.

View File

@@ -172,7 +172,8 @@ class ObjectStorage {
* @param HPCloud::Services::IdentityServices $identity
* An identity services object that already has a valid token and a
* service catalog.
* @retval object ObjectStorage
* @retval HPCloud::Storage::ObjectStorage
* @return \HPCloud\Storage\ObjectStorage
* A new ObjectStorage instance.
*/
public static function newFromIdentity($identity) {
@@ -196,7 +197,8 @@ class ObjectStorage {
* just ObjectStorage::SERVICE_TYPE.
* @param string $authToken
* The auth token returned by IdentityServices.
* @retval object ObjectStorage
* @retval HPCloud::Storage::ObjectStorage
* @return \HPCloud\Storage\ObjectStorage
* A new ObjectStorage instance.
*/
public static function newFromServiceCatalog($catalog, $authToken) {
@@ -245,6 +247,10 @@ class ObjectStorage {
* objects in CDN can be older than objects in Swift itself. For that
* reason, CDN should not be used when a combination of read and write
* operations occur.
*
* @retval HPCloud::Storage::ObjectStorage
* @return \HPCloud\Storage\ObjectStorage
* $this for current object so the method can be used in chaining.
*/
public function useCDN($cdn) {
@@ -268,6 +274,8 @@ class ObjectStorage {
}
}
$this->cdnContainers = $buffer;
return $this;
}
public function hasCDN() {
@@ -286,6 +294,7 @@ class ObjectStorage {
* If this is TRUE (default), get the URL to the SSL CDN;
* otherwise get the URL to the plain HTTP CDN.
* @retval string
* @return string
* The URL to the CDN container, or NULL if no such
* URL is found.
*/
@@ -300,6 +309,7 @@ class ObjectStorage {
* Get the authentication token.
*
* @retval string
* @return string
* The authentication token.
*/
public function token() {
@@ -310,6 +320,7 @@ class ObjectStorage {
* Get the URL endpoint.
*
* @retval string
* @return string
* The URL that is the endpoint for this service.
*/
public function url() {
@@ -346,6 +357,7 @@ class ObjectStorage {
* The name of the last object seen. Used when paging.
*
* @retval array
* @return array
* An associative array of containers, where the key is the
* container's name and the value is an
* HPCloud::Storage::ObjectStorage::Container object. Results are
@@ -387,6 +399,7 @@ class ObjectStorage {
* @param string $name
* The name of the container to load.
* @retval HPCloud::Storage::ObjectStorage::Container
* @return \HPCloud\Storage\ObjectStorage\Container
* A container.
* @throws HPCloud::Transport::FileNotFoundException
* if the named container is not found on the remote server.
@@ -422,6 +435,7 @@ class ObjectStorage {
* @param string $name
* The name of the container to test.
* @retval boolean
* @return boolean
* TRUE if the container exists, FALSE if it does not.
* @throws HPCloud::Exception
* If an unexpected network error occurs.
@@ -495,6 +509,7 @@ class ObjectStorage {
* @param array $metadata
* An associative array of metadata to attach to the container.
* @retval boolean
* @return boolean
* TRUE if the container was created, FALSE if the container was not
* created because it already exists.
*/
@@ -558,6 +573,7 @@ class ObjectStorage {
* An ACL. To make the container publically readable, use
* ACL::makePublic().
* @retval boolean
* @return boolean
* TRUE if the cointainer was created, FALSE otherwise.
*/
public function changeContainerACL($name, ACL $acl) {
@@ -579,6 +595,7 @@ class ObjectStorage {
* @param string $name
* The name of the container.
* @retval boolean
* @return boolean
* TRUE if the container was deleted, FALSE if the container was not
* found (and hence, was not deleted).
* @throws HPCloud::Storage::ObjectStorage::ContainerNotEmptyException
@@ -625,6 +642,7 @@ class ObjectStorage {
* - The number of containers (`count`).
*
* @retval array
* @return array
* An associative array of account info. Typical keys are:
* - bytes: Bytes consumed by existing content.
* - containers: Number of containers.

View File

@@ -152,6 +152,7 @@ class ACL {
* - READ to any host, with container listings.
*
* @retval HPCloud::Storage::ObjectStorage::ACL
* @return \HPCloud\Storage\ObjectStorage\ACL
* an ACL object with the appopriate permissions set.
*/
public static function makePublic() {
@@ -172,6 +173,7 @@ class ACL {
* with no permissions as a private object.
*
* @retval HPCloud::Storage::ObjectStorage::ACL
* @return \HPCloud\Storage\ObjectStorage\ACL
* an ACL object with the appopriate permissions set.
*/
public static function makeNonPublic() {
@@ -194,7 +196,8 @@ class ACL {
*
* @param array $headers
* An associative array of headers.
* @retval ACL
* @retval HPCloud::Storage::ObjectStorage::ACL
* @return \HPCloud\Storage\ObjectStorage\ACL
* A new ACL.
*/
public static function newFromHeaders($headers) {
@@ -242,6 +245,7 @@ class ACL {
* @param string $rule
* The string rule to parse.
* @retval array
* @return array
* The rule as an array.
*/
public static function parseRule($perm, $rule) {
@@ -319,6 +323,10 @@ class ACL {
* @param mixed $user
* The name of the user, or optionally an indexed array of user
* names.
*
* @retval HPCloud::Storage::ObjectStorage::ACL
* @return \HPCloud\Storage\ObjectStorage\ACL
* $this for current object so the method can be used in chaining.
*/
public function addAccount($perm, $account, $user = NULL) {
$rule = array('account' => $account);
@@ -328,6 +336,8 @@ class ACL {
}
$this->addRule($perm, $rule);
return $this;
}
/**
@@ -350,9 +360,15 @@ class ACL {
* The permission being granted. One of ACL:READ, ACL::WRITE, or ACL::READ_WRITE.
* @param string $host
* A host specification string as described above.
*
* @retval HPCloud::Storage::ObjectStorage::ACL
* @return \HPCloud\Storage\ObjectStorage\ACL
* $this for current object so the method can be used in chaining.
*/
public function addReferrer($perm, $host = '*') {
$this->addRule($perm, array('host' => $host));
return $this;
}
/**
@@ -362,11 +378,17 @@ class ACL {
* One of the predefined permission constants.
* @param array $rule
* A rule array.
*
* @retval HPCloud::Storage::ObjectStorage::ACL
* @return \HPCloud\Storage\ObjectStorage\ACL
* $this for current object so the method can be used in chaining.
*/
protected function addRule($perm, $rule) {
$rule['mask'] = $perm;
$this->rules[] = $rule;
return $this;
}
/**
@@ -379,6 +401,10 @@ class ACL {
*
* In the current Swift implementation, there is no mechanism for
* allowing some hosts to get listings, while denying others.
*
* @retval HPCloud::Storage::ObjectStorage::ACL
* @return \HPCloud\Storage\ObjectStorage\ACL
* $this for current object so the method can be used in chaining.
*/
public function allowListings() {
@@ -386,12 +412,15 @@ class ACL {
'mask' => self::READ,
'rlistings' => TRUE,
);
return $this;
}
/**
* Get the rules array for this ACL.
*
* @retval array
* @return array
* An array of associative arrays of rules.
*/
public function rules() {
@@ -496,6 +525,7 @@ class ACL {
* at all.
*
* @retval boolean
* @return boolean
* TRUE if this is private (non-public), FALSE if
* any permissions are granted via this ACL.
*/
@@ -544,6 +574,7 @@ class ACL {
* a pretty string.
*
* @retval string
* @return string
* The ACL represented as a string.
*/
public function __toString() {

View File

@@ -110,6 +110,7 @@ class Container implements \Countable, \IteratorAggregate {
* @param string $prefix
* A prefix for the metadata headers.
* @retval array
* @return array
* An array of headers.
* @see http://docs.openstack.org/bexar/openstack-object-storage/developer/content/ch03s03.html#d5e635
* @see http://docs.openstack.org/bexar/openstack-object-storage/developer/content/ch03s03.html#d5e700
@@ -143,6 +144,7 @@ class Container implements \Countable, \IteratorAggregate {
* @param string $oname
* The name of the object.
* @retval string
* @return string
* The URL to the object. Characters that need escaping will be escaped,
* while slash characters are not. Thus, the URL will look pathy.
*/
@@ -179,6 +181,7 @@ class Container implements \Countable, \IteratorAggregate {
* @param string $prefix
* The prefix on metadata headers.
* @retval array
* @return array
* An associative array of name/value attribute pairs.
*/
public static function extractHeaderAttributes($headers, $prefix = NULL) {
@@ -211,6 +214,10 @@ class Container implements \Countable, \IteratorAggregate {
* @param string $url
* The base URL. The container name is automatically appended to
* this at construction time.
*
* @retval HPCloud::Storage::ObjectStorage::Comtainer
* @return \HPCloud\Storage\ObjectStorage\Container
* A new container object.
*/
public static function newFromJSON($jsonArray, $token, $url) {
$container = new Container($jsonArray['name']);
@@ -252,7 +259,8 @@ class Container implements \Countable, \IteratorAggregate {
* @param string $url
* The base URL. The container name is automatically appended to
* this at construction time.
* @retval Container
* @retval HPCloud::Storage::ObjectStorage::Container
* @return \HPCloud\Storage\ObjectStorage\Container
* The Container object, initialized and ready for use.
*/
public static function newFromResponse($name, $response, $token, $url) {
@@ -348,6 +356,7 @@ class Container implements \Countable, \IteratorAggregate {
* Get the name of this container.
*
* @retval string
* @return string
* The name of the container.
*/
public function name() {
@@ -358,6 +367,7 @@ class Container implements \Countable, \IteratorAggregate {
* Get the number of bytes in this container.
*
* @retval int
* @return int
* The number of bytes in this container.
*/
public function bytes() {
@@ -383,6 +393,7 @@ class Container implements \Countable, \IteratorAggregate {
* directly does.
*
* @retval array
* @return array
* An array of metadata name/value pairs.
*/
public function metadata() {
@@ -412,9 +423,15 @@ class Container implements \Countable, \IteratorAggregate {
* Names can be no longer than 128 characters, and values can be no
* more than 256. UTF-8 or ASCII characters are allowed, though ASCII
* seems to be preferred.
*
* @retval HPCloud::Storage::ObjectStorage::Container
* @return \HPCloud\Storage\ObjectStorage\Container
* $this so the method can be used in chaining.
*/
public function setMetadata($metadata) {
$this->metadata = $metadata;
return $this;
}
/**
@@ -430,6 +447,7 @@ class Container implements \Countable, \IteratorAggregate {
* @endcode
*
* @retval int
* @return int
* The number of items in this container.
*/
public function count() {
@@ -452,6 +470,7 @@ class Container implements \Countable, \IteratorAggregate {
* An optional file argument that, if set, will be treated as the
* contents of the object.
* @retval boolean
* @return boolean
* TRUE if the object was saved.
* @throws HPCloud::Transport::LengthRequiredException
* if the Content-Length could not be determined and chunked
@@ -571,6 +590,7 @@ class Container implements \Countable, \IteratorAggregate {
* The object to update.
*
* @retval boolean
* @return boolean
* TRUE if the metadata was updated.
*
* @throws HPCloud::Transport::FileNotFoundException
@@ -689,7 +709,8 @@ class Container implements \Countable, \IteratorAggregate {
* If this is TRUE (the default), then SSL will always be
* used. If this is FALSE, then CDN-based fetching will
* use non-SSL, which is faster.
* @retval \HPCloud\Storage\ObjectStorage\RemoteObject
* @retval HPCloud::Storage::ObjectStorage::RemoteObject
* @return \HPCloud\Storage\ObjectStorage\RemoteObject
* A remote object with the content already stored locally.
*/
public function object($name, $requireSSL = TRUE) {
@@ -753,7 +774,8 @@ class Container implements \Countable, \IteratorAggregate {
*
* @param string $name
* The name of the object to fetch.
* @retval \HPCloud\Storage\ObjectStorage\RemoteObject
* @retval HPCloud::Storage::ObjectStorage::RemoteObject
* @return \HPCloud\Storage\ObjectStorage\RemoteObject
* A remote object ready for use.
*/
public function proxyObject($name) {
@@ -824,6 +846,7 @@ class Container implements \Countable, \IteratorAggregate {
* The name of the object to start with. The query will begin with
* the next object AFTER this one.
* @retval array
* @return array
* List of RemoteObject or Subdir instances.
*/
public function objects($limit = NULL, $marker = NULL) {
@@ -885,6 +908,7 @@ class Container implements \Countable, \IteratorAggregate {
* The name of the object to start with. The query will begin with
* the next object AFTER this one.
* @retval array
* @return array
* List of RemoteObject or Subdir instances.
*/
public function objectsWithPrefix($prefix, $delimiter = '/', $limit = NULL, $marker = NULL) {
@@ -950,6 +974,7 @@ class Container implements \Countable, \IteratorAggregate {
* ObjectStorage::createContainer()) will be accessible by this URL.
*
* @retval string
* @return string
* The URL.
*/
public function url() {
@@ -975,6 +1000,7 @@ class Container implements \Countable, \IteratorAggregate {
*
* @todo Determine how to get the ACL from JSON data.
* @retval \HPCloud\Storage\ObjectStorage\ACL
* @return HPCloud::Storage::ObjectStorage::ACL
* An ACL, or NULL if the ACL could not be retrieved.
*/
public function acl() {
@@ -989,6 +1015,9 @@ class Container implements \Countable, \IteratorAggregate {
*
* Not all containers come fully instantiated. This method is sometimes
* called to "fill in" missing fields.
*
* @retval HPCloud::Storage::ObjectStorage::Comtainer
* @return \HPCloud\Storage\ObjectStorage\Container
*/
protected function loadExtraData() {
@@ -1017,6 +1046,7 @@ class Container implements \Countable, \IteratorAggregate {
$prefix = Container::CONTAINER_METADATA_HEADER_PREFIX;
$this->setMetadata(Container::extractHeaderAttributes($response->headers(), $prefix));
return $this;
}
/**
@@ -1111,6 +1141,7 @@ class Container implements \Countable, \IteratorAggregate {
* @param string $name
* The name of the object to remove.
* @retval boolean
* @return boolean
* TRUE if the file was deleted, FALSE if no such file is found.
*/
public function delete($name) {

View File

@@ -147,9 +147,14 @@ class Object {
*
* @param array $array
* An associative array of metadata names to values.
*
* @retval HPCloud::Storage::ObjectStorage::Object
* @return \HPCloud\Storage\ObjectStorage\Object
* $this so the method can be used in chaining.
*/
public function setMetadata(array $array) {
$this->metadata = $array;
return $this;
}
@@ -159,6 +164,7 @@ class Object {
* This returns an associative array of all metadata for this object.
*
* @retval array
* @return array
* An associative array of metadata. This may be empty.
*/
public function metadata() {
@@ -178,6 +184,10 @@ class Object {
*
* @param string $name
* A file or object name.
*
* @retval HPCloud::Storage::ObjectStorage::Object
* @return \HPCloud\Storage\ObjectStorage\Object
* $this so the method can be used in chaining.
*/
public function setName($name) {
$this->name = $name;
@@ -191,6 +201,7 @@ class Object {
* using setName(), this will return the latest (overwritten) name.
*
* @retval string
* @return string
* The name of the object.
*/
public function name() {
@@ -223,6 +234,10 @@ class Object {
*
* @param string $type
* A valid content type.
*
* @retval HPCloud::Storage::ObjectStorage::Object
* @return \HPCloud\Storage\ObjectStorage\Object
* $this so the method can be used in chaining.
*/
public function setContentType($type) {
$this->contentType = $type;
@@ -235,6 +250,7 @@ class Object {
* This returns the currently set content type.
*
* @retval string
* @return string
* The content type, including any additional options.
*/
public function contentType() {
@@ -261,6 +277,10 @@ class Object {
* @param string $type
* The content type (MIME type). This can be set here for
* convenience, or you can call setContentType() directly.
*
* @retval HPCloud::Storage::ObjectStorage::Object
* @return \HPCloud\Storage\ObjectStorage\Object
* $this so the method can be used in chaining.
*/
public function setContent($content, $type = NULL) {
$this->content = $content;
@@ -289,6 +309,7 @@ class Object {
* returns the entire contents of an object.
*
* @retval string
* @return string
* The content of the file.
*/
public function content() {
@@ -306,7 +327,8 @@ class Object {
* When extending this class, you should make sure to calculate the
* content length appropriately.
*
* return int
* @retval int
* @return int
* The length of the content, in bytes.
*/
public function contentLength() {
@@ -324,6 +346,7 @@ class Object {
* the entire object's content (but not the metadata or name).
*
* @retval string
* @return string
* An MD5 value as a string of 32 hex digits (0-9a-f).
*/
public function eTag() {
@@ -348,9 +371,15 @@ class Object {
*
* @param string $encoding
* A valid encoding type.
*
* @retval HPCloud::Storage::ObjectStorage::Object
* @return \HPCloud\Storage\ObjectStorage\Object
* $this so the method can be used in chaining.
*/
public function setEncoding($encoding) {
$this->contentEncoding = $encoding;
return $this;
}
/**
@@ -360,6 +389,7 @@ class Object {
* See setEncoding() for more information.
*
* @retval string
* @return string
* The encoding type.
*/
public function encoding() {
@@ -386,9 +416,15 @@ class Object {
* @param string $disposition
* A valid disposition declaration. These are defined in various
* HTTP specifications.
*
* @retval HPCloud::Storage::ObjectStorage::Object
* @return \HPCloud\Storage\ObjectStorage\Object
* $this so the method can be used in chaining.
*/
public function setDisposition($disposition) {
$this->contentDisposition = $disposition;
return $this;
}
/**
@@ -397,6 +433,7 @@ class Object {
* See setDisposition() for discussion.
*
* @retval string
* @return string
* The disposition string, or NULL if none is set.
*/
public function disposition() {
@@ -436,9 +473,14 @@ class Object {
* An associative array where each name is an HTTP header name, and
* each value is the HTTP header value. No encoding or escaping is
* done.
*
* @retval HPCloud::Storage::ObjectStorage::Object
* @return \HPCloud\Storage\ObjectStorage\Object
* $this so the method can be used in chaining.
*/
public function setAdditionalHeaders($headers) {
$this->additionalHeaders = $headers;
return $this;
}
/**
@@ -466,11 +508,17 @@ class Object {
*
* @param array $keys
* The header names to be removed.
*
* @retval HPCloud::Storage::ObjectStorage::Object
* @return \HPCloud\Storage\ObjectStorage\Object
* $this for the current object so it can be used in chaining methods.
*/
public function removeHeaders($keys) {
foreach ($keys as $k) {
unset($this->additionalHeaders[$k]);
}
return $this;
}
/**
@@ -490,6 +538,7 @@ class Object {
* if this returns TRUE, contentLength() is ignored.
*
* @retval boolean
* @return boolean
* TRUE to recommend chunked transfer, FALSE otherwise.
*/
public function isChunked() {

View File

@@ -121,6 +121,10 @@ class RemoteObject extends Object {
* CDN URL when requested.
* @param string $cdnSslUrl
* The URL to the SSL-protected CDN version of the object.
*
* @retval HPCloud::Storage::ObjectStorage::RemoteObject
* @return \HPCloud\Storage\ObjectStorage\RemoteObject
* A new RemoteObject.
*/
public static function newFromHeaders($name, $headers, $token, $url, $cdnUrl = NULL, $cdnSslUrl = NULL) {
$object = new RemoteObject($name);
@@ -183,10 +187,16 @@ class RemoteObject extends Object {
* The URL to this object in CDN.
* @param string $sslUrl
* The SSL URL to this object in CDN.
*
* @retval HPCloud::Storage::ObjectStorage::RemoteObject
* @return \HPCloud\Storage\ObjectStorage\RemoteObject
* $this for the current object so it can be used in chaining methods.
*/
public function useCDN($url, $sslUrl) {
$this->cdnUrl = $url;
$this->cdnSslUrl = $sslUrl;
return $this;
}
/**
@@ -210,6 +220,7 @@ class RemoteObject extends Object {
* (b) it mirrors non-CDN behavior. This can be turned off by setting
* $useSSL to FALSE.
* @retval string
* @return string
* A URL to the object. The following considerations apply:
* - If the container is public, this URL can be loaded without
* authentication. You can, for example, pass the URL to a browser
@@ -260,6 +271,13 @@ class RemoteObject extends Object {
return $this->metadata;
}
/**
* Set the headers
*
* @retval HPCloud::Storage::ObjectStorage::RemoteObject
* @return \HPCloud\Storage\ObjectStorage\RemoteObject
* $this for the current object so it can be used in chaining methods.
*/
public function setHeaders($headers) {
$this->allHeaders = array();
@@ -268,6 +286,8 @@ class RemoteObject extends Object {
$this->allHeaders[$name] = $value;
}
}
return $this;
}
/**
@@ -279,6 +299,7 @@ class RemoteObject extends Object {
* were sent from the server.
*
* @retval array
* @return array
* An associative array of header names and values.
*/
public function headers() {
@@ -307,6 +328,14 @@ class RemoteObject extends Object {
'transfer-encoding' => TRUE,
'x-trans-id' => TRUE,
);
/**
* Filter the headers.
*
* @retval HPCloud::Storage::ObjectStorage::RemoteObject
* @return \HPCloud\Storage\ObjectStorage\RemoteObject
* $this for the current object so it can be used in chaining methods.
*/
public function filterHeaders(&$headers) {
$unset = array();
foreach ($headers as $name => $value) {
@@ -318,6 +347,8 @@ class RemoteObject extends Object {
foreach ($unset as $u) {
unset($headers[$u]);
}
return $this;
}
/**
@@ -337,12 +368,18 @@ class RemoteObject extends Object {
*
* @param array $keys
* The header names to be removed.
*
* @retval HPCloud::Storage::ObjectStorage::RemoteObject
* @return \HPCloud\Storage\ObjectStorage\RemoteObject
* $this for the current object so it can be used in chaining methods.
*/
public function removeHeaders($keys) {
foreach ($keys as $key) {
unset($this->allHeaders[$key]);
unset($this->additionalHeaders[$key]);
}
return $this;
}
/**
@@ -361,6 +398,7 @@ class RemoteObject extends Object {
* Be wary of using this method with large files.
*
* @retval string
* @return string
* The contents of the file as a string.
* @throws \HPCloud\Transport\FileNotFoundException
* when the requested content cannot be located on the remote
@@ -427,6 +465,7 @@ class RemoteObject extends Object {
* and the content will be refreshed from the server. Any
* local changes to the object will be discarded.
* @retval resource
* @return resource
* A handle to the stream, which is already opened and positioned at
* the beginning of the stream.
*/
@@ -478,9 +517,14 @@ class RemoteObject extends Object {
* @param boolean $enabled
* If this is TRUE, caching will be enabled. If this is FALSE,
* caching will be disabled.
*
* @retval HPCloud::Storage::ObjectStorage::RemoteObject
* @return \HPCloud\Storage\ObjectStorage\RemoteObject
* $this so the method can be used in chaining.
*/
public function setCaching($enabled) {
$this->caching = $enabled;
return $this;
}
/**
@@ -490,6 +534,7 @@ class RemoteObject extends Object {
* its contents, not whether anything is actually cached.
*
* @retval boolean
* @return boolean
* TRUE if caching is enabled, FALSE otherwise.
*/
public function isCaching() {
@@ -518,9 +563,14 @@ class RemoteObject extends Object {
* If this is TRUE, content verification is performed. The content
* is hashed and checked against a server-supplied MD5 hashcode. If
* this is FALSE, no checking is done.
*
* @retval HPCloud::Storage::ObjectStorage::RemoteObject
* @return \HPCloud\Storage\ObjectStorage\RemoteObject
* $this so the method can be used in chaining.
*/
public function setContentVerification($enabled) {
$this->contentVerification = $enabled;
return $this;
}
/**
@@ -532,6 +582,7 @@ class RemoteObject extends Object {
* supplied ETag hash.
*
* @retval boolean
* @return boolean
* TRUE if this is verifying, FALSE otherwise.
*/
public function isVerifyingContent() {
@@ -588,6 +639,10 @@ class RemoteObject extends Object {
*
* @param boolean $fetchContent
* If this is TRUE, the content will be downloaded as well.
*
* @retval HPCloud::Storage::ObjectStorage::RemoteObject
* @return \HPCloud\Storage\ObjectStorage\RemoteObject
* $this for the current object so it can be used in chaining methods.
*/
public function refresh($fetchContent = FALSE) {
@@ -600,6 +655,8 @@ class RemoteObject extends Object {
if ($fetchContent) {
$this->setContent($response->content());
}
return $this;
}
/**
@@ -610,7 +667,8 @@ class RemoteObject extends Object {
* cause the remote host to return the object in the response body.
* The response body is not handled, though. If this is set to
* FALSE, a HEAD request is sent, and no body is returned.
* @retval \HPCloud\Transport\Response
* @retval HPCloud::Transport::Response
* @return \HPCloud\Transport\Response
* containing the object metadata and (depending on the
* $fetchContent flag) optionally the data.
*/
@@ -642,6 +700,10 @@ class RemoteObject extends Object {
* Extract information from HTTP headers.
*
* This is used internally to set object properties from headers.
*
* @retval HPCloud::Storage::ObjectStorage::RemoteObject
* @return \HPCloud\Storage\ObjectStorage\RemoteObject
* $this for the current object so it can be used in chaining methods.
*/
protected function extractFromHeaders($response) {
$this->setContentType($response->header('Content-Type', $this->contentType()));
@@ -655,5 +717,7 @@ class RemoteObject extends Object {
// Reset the metadata, too:
$this->setMetadata(Container::extractHeaderAttributes($response->headers()));
return $this;
}
}

View File

@@ -407,6 +407,7 @@ class StreamWrapper {
* @param int $options
* Unused.
* @retval boolean
* @return boolean
* TRUE if the directory is opened, FALSE otherwise.
*/
public function dir_opendir($path, $options) {
@@ -462,6 +463,7 @@ class StreamWrapper {
* @endcode
*
* @retval string
* @return string
* The name of the resource or FALSE when the directory has no more
* entries.
*/
@@ -562,6 +564,7 @@ class StreamWrapper {
* @param string $path_to
* A swift URL to another path.
* @retval boolean
* @return boolean
* TRUE on success, FALSE otherwise.
*/
public function rename($path_from, $path_to) {
@@ -609,6 +612,7 @@ class StreamWrapper {
* side effects.
*
* @retval resource
* @return resource
* this returns the underlying stream.
*/
public function stream_cast($cast_as) {
@@ -662,6 +666,7 @@ class StreamWrapper {
* See stream_seek().
*
* @retval boolean
* @return boolean
* TRUE if it has reached the end, FALSE otherwise.
*/
public function stream_eof() {
@@ -969,6 +974,7 @@ class StreamWrapper {
* @param int $count
* The number of bytes to read (usually 8192).
* @retval string
* @return string
* The data read.
*/
public function stream_read($count) {
@@ -1034,6 +1040,7 @@ class StreamWrapper {
* etc.) through HPCloud::Bootstrap::setConfiguration().
*
* @retval array
* @return array
* The stats array.
*/
public function stream_stat() {
@@ -1052,6 +1059,7 @@ class StreamWrapper {
* See ftell() and fseek().
*
* @retval int
* @return int
* The current position in the stream.
*/
public function stream_tell() {
@@ -1068,6 +1076,7 @@ class StreamWrapper {
* @param string $data
* Data to write to the stream.
* @retval int
* @return int
* The number of bytes written. 0 indicates and error.
*/
public function stream_write($data) {
@@ -1094,6 +1103,7 @@ class StreamWrapper {
* @param string $path
* The URL.
* @retval boolean
* @return boolean
* TRUE if the file was deleted, FALSE otherwise.
*/
public function unlink($path) {
@@ -1320,6 +1330,10 @@ class StreamWrapper {
*
* @param string $mode
* The mode string, e.g. `r+` or `wb`.
*
* @retval HPCloud::Storage::ObjectStorage::StreamWrapper
* @return \HPCloud\Storage\ObjectStorage\StreamWrapper
* $this so the method can be used in chaining.
*/
protected function setMode($mode) {
$mode = strtolower($mode);
@@ -1391,6 +1405,7 @@ class StreamWrapper {
}
return $this;
}
/**
@@ -1404,6 +1419,7 @@ class StreamWrapper {
* @param mixed $default
* The default value to return if no config param was found.
* @retval mixed
* @return mixed
* The discovered result, or $default if specified, or NULL if
* no $default is specified.
*/
@@ -1450,6 +1466,7 @@ class StreamWrapper {
* @param string $url
* A Swift URL.
* @retval array
* @return array
* An array as documented in parse_url().
*/
protected function parseUrl($url) {

View File

@@ -148,7 +148,8 @@ class StreamWrapperFS extends StreamWrapper {
*
* @param string $path
* The directory path to test.
* @retval bool
* @retval boolean
* @return boolean
* TRUE if the directory prefix exists and FALSE otherwise.
*/
protected function testDirectoryExists($path) {

View File

@@ -61,6 +61,7 @@ class Subdir {
* The path is delimited using the string returned by delimiter().
*
* @retval string
* @return string
* The path.
*/
public function path() {
@@ -70,6 +71,7 @@ class Subdir {
* Get the delimiter used by the server.
*
* @retval string
* @return string
* The value used as a delimiter.
*/
public function delimiter() {

View File

@@ -72,6 +72,7 @@ class Transport {
* @endcode
*
* @retval HPCloud::Transport::Transporter
* @return \HPCloud\Transport\Transporter
* An initialized transporter.
*/
public static function instance() {

View File

@@ -278,6 +278,7 @@ class CURLTransport implements Transporter {
* @param resource $handle
* A CURL handle from curl_init().
* @retval boolean
* @return boolean
* Returns a boolean value indicating whether or not CURL could process the
* request.
*/
@@ -322,6 +323,7 @@ class CURLTransport implements Transporter {
* @param resource $file
* A file pointer to the file that has the headers.
* @retval array
* @return array
* An array of headers, one header per line.
*/
protected function fetchHeaders($file) {
@@ -389,5 +391,7 @@ class CURLTransport implements Transporter {
}
curl_setopt($curl, CURLOPT_HTTPHEADER, $buffer);
return $this;
}
}

View File

@@ -207,6 +207,7 @@ class PHPStreamTransport implements Transporter {
* @param array $headers
* An associative array of header names to header values.
* @retval string
* @return string
* A string containing formatted headers.
*/
protected function smashHeaders($headers) {

View File

@@ -143,6 +143,7 @@ class Response {
* (they are one and the same).
*
* @retval resource
* @return resource
* A file handle.
*/
public function file() {
@@ -162,6 +163,7 @@ class Response {
* entire content in a string.
*
* @retval string
* @return string
* The contents of the response body.
*/
public function content() {
@@ -203,6 +205,7 @@ class Response {
* data.
*
* @retval array
* @return array
* An associative array of metadata about the
* transaction resulting in this response.
*/
@@ -219,6 +222,7 @@ class Response {
* An optional default value.
*
* @retval mixed
* @return mixed
* The value, if found, or the default, is specified, or NULL.
*/
public function header($name, $default = NULL) {
@@ -237,8 +241,9 @@ class Response {
*
* These are available even if the stream has been closed.
*
* @retval
* array The array of headers.
* @retval array
* @return array
* The array of headers.
*/
public function headers() {
return $this->headers;
@@ -266,6 +271,7 @@ class Response {
* appear in a Response object.
*
* @retval int
* @return int
* The HTTP code, e.g. 200 or 202.
*/
public function status() {
@@ -279,6 +285,7 @@ class Response {
* recommendations. e.g. 200 returns 'OK'.
*
* @retval string
* @return string
* A server-generated status message.
*/
public function statusMessage() {
@@ -291,6 +298,7 @@ class Response {
* Example: HTTP/1.1
*
* @retval string
* @return string
* The protocol name and version.
*/
public function protocol() {
@@ -308,6 +316,7 @@ class Response {
* An indexed array of headers, as returned by the PHP stream
* library.
* @retval array
* @return array
* An associative array of header name/value pairs.
*/
protected function parseHeaders($headerArray) {

View File

@@ -41,11 +41,11 @@ class DBaaSInstanceTest extends DBaaSTestCase {
$ident = $this->identity();
$dbaas = DBaaS::newFromIdentity($ident);
$endpoint = self::conf('hpcloud.dbaas.endpoint') . '/' . $ident->tenantId();
// $endpoint = self::conf('hpcloud.dbaas.endpoint') . '/' . $ident->tenantId();
// Test #1: Build from scratch.
$inst = new Instance($ident->token(), $ident->tenantName(), $endpoint);
$this->assertInstanceOf('\HPCloud\Services\DBaaS\Instance', $inst);
// // Test #1: Build from scratch.
// $inst = new Instance($ident->token(), $ident->tenantName(), $endpoint);
// $this->assertInstanceOf('\HPCloud\Services\DBaaS\Instance', $inst);
// Test #2: Build from DBaaS.
$inst = $dbaas->instance();

View File

@@ -33,6 +33,12 @@ hpcloud.identity.password =
hpcloud.identity.account =
hpcloud.identity.secret =
;;;;;;;;;;;;;;;;;;;;;;;;;
; Database as a Service ;
;;;;;;;;;;;;;;;;;;;;;;;;;
hpcloud.dbaas.database = "ponycorns"
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Configuration Parameters ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;