This repository has been archived by the owner on Jan 31, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'weierophinney/feature/forms'
- Loading branch information
84 parents
425826b
+
f0e91f0
+
e31468f
+
7d2af87
+
2e4dc80
+
19d128f
+
1b9e4b2
+
1c46483
+
fdda3f2
+
595fcd1
+
213395c
+
8e514a8
+
2f30186
+
bb4ed65
+
132d5b6
+
030ff33
+
f2f20f3
+
a50e133
+
4c554ee
+
dbfb1b8
+
ccab83f
+
00b350f
+
78945d0
+
f0e5f4b
+
ceb7d8c
+
9e124d1
+
3de5912
+
b6a974a
+
10a6438
+
cb6c1e7
+
18afd6c
+
3baf1bd
+
c800904
+
f52dcb8
+
126ccb2
+
e7d6206
+
e2d24ab
+
ec1abfc
+
290ea90
+
9f4ca1b
+
edaa760
+
c4c0c95
+
d21f055
+
5b18029
+
e6b97af
+
010fb36
+
64c7b8d
+
636523e
+
4cc2cd6
+
e34098a
+
16367cd
+
943c77f
+
8226e5b
+
0b47726
+
3cd8a03
+
cc4782c
+
9c653a6
+
656dbe5
+
9bce1ba
+
7dc18ca
+
861130d
+
2d2ffbd
+
4f413a5
+
2e1067a
+
1d082e4
+
e8aeb79
+
b562091
+
ff2fdc3
+
4aa72c0
+
1bb67ac
+
cd015c8
+
5e89910
+
0c21258
+
dd54faf
+
57f9063
+
b88ce2e
+
af68643
+
06cd3b4
+
2c71b71
+
ee02c35
+
9456314
+
5a77a7b
+
e98a077
+
50bab16
commit 05d33c4
Showing
5 changed files
with
257 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
Zend/Amf | ||
Zend/Date | ||
Zend/Dojo | ||
Zend/Queue | ||
Zend/Service | ||
Zend/Test | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
/** | ||
* Zend Framework | ||
* | ||
* LICENSE | ||
* | ||
* This source file is subject to the new BSD license that is bundled | ||
* with this package in the file LICENSE.txt. | ||
* It is also available through the world-wide-web at this URL: | ||
* http://framework.zend.com/license/new-bsd | ||
* If you did not receive a copy of the license and are unable to | ||
* obtain it through the world-wide-web, please send an email | ||
* to license@zend.com so we can send you a copy immediately. | ||
* | ||
* @category Zend | ||
* @package Zend_Stdlib | ||
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) | ||
* @license http://framework.zend.com/license/new-bsd New BSD License | ||
*/ | ||
|
||
namespace Zend\Stdlib; | ||
|
||
/** | ||
* @category Zend | ||
* @package Zend_Stdlib | ||
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) | ||
* @license http://framework.zend.com/license/new-bsd New BSD License | ||
*/ | ||
interface ArraySerializableInterface | ||
{ | ||
/** | ||
* Exchange internal values from provided array | ||
* | ||
* @param array $array | ||
* @return void | ||
*/ | ||
public function exchangeArray(array $array); | ||
|
||
/** | ||
* Return an array representation of the object | ||
* | ||
* @return array | ||
*/ | ||
public function getArrayCopy(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
<?php | ||
/** | ||
* Zend Framework | ||
* | ||
* LICENSE | ||
* | ||
* This source file is subject to the new BSD license that is bundled | ||
* with this package in the file LICENSE.txt. | ||
* It is also available through the world-wide-web at this URL: | ||
* http://framework.zend.com/license/new-bsd | ||
* If you did not receive a copy of the license and are unable to | ||
* obtain it through the world-wide-web, please send an email | ||
* to license@zend.com so we can send you a copy immediately. | ||
* | ||
* @category Zend | ||
* @package Zend_Stdlib | ||
* @subpackage Hydrator | ||
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) | ||
* @license http://framework.zend.com/license/new-bsd New BSD License | ||
*/ | ||
|
||
namespace Zend\Stdlib\Hydrator; | ||
|
||
use Zend\Stdlib\Exception; | ||
|
||
/** | ||
* @category Zend | ||
* @package Zend_Stdlib | ||
* @subpackage Hydrator | ||
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) | ||
* @license http://framework.zend.com/license/new-bsd New BSD License | ||
*/ | ||
class ArraySerializable implements HydratorInterface | ||
{ | ||
/** | ||
* Extract values from the provided object | ||
* | ||
* Extracts values via the object's getArrayCopy() method. | ||
* | ||
* @param object $object | ||
* @return array | ||
* @throws Exception\BadMethodCallException for an $object not implementing getArrayCopy() | ||
*/ | ||
public function extract($object) | ||
{ | ||
if (!is_callable(array($object, 'getArrayCopy'))) { | ||
throw new Exception\BadMethodCallException(sprintf( | ||
'%s expects the provided object to implement getArrayCopy()', | ||
__METHOD__ | ||
)); | ||
} | ||
return $object->getArrayCopy(); | ||
} | ||
|
||
/** | ||
* Hydrate an object | ||
* | ||
* Hydrates an object by passing $data to either its exchangeArray() or | ||
* populate() method. | ||
* | ||
* @param array $data | ||
* @param object $object | ||
* @return void | ||
* @throws Exception\BadMethodCallException for an $object not implementing exchangeArray() or populate() | ||
*/ | ||
public function hydrate(array $data, $object) | ||
{ | ||
if (!is_callable(array($object, 'exchangeArray')) | ||
&& !is_callable(array($object, 'populate')) | ||
) { | ||
throw new Exception\BadMethodCallException(sprintf( | ||
'%s expects the provided object to implement exchangeArray() or populate()', | ||
__METHOD__ | ||
)); | ||
} | ||
|
||
if (is_callable(array($object, 'exchangeArray'))) { | ||
$object->exchangeArray($data); | ||
return; | ||
} | ||
|
||
$object->populate($data); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?php | ||
/** | ||
* Zend Framework | ||
* | ||
* LICENSE | ||
* | ||
* This source file is subject to the new BSD license that is bundled | ||
* with this package in the file LICENSE.txt. | ||
* It is also available through the world-wide-web at this URL: | ||
* http://framework.zend.com/license/new-bsd | ||
* If you did not receive a copy of the license and are unable to | ||
* obtain it through the world-wide-web, please send an email | ||
* to license@zend.com so we can send you a copy immediately. | ||
* | ||
* @category Zend | ||
* @package Zend_Stdlib | ||
* @subpackage Hydrator | ||
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) | ||
* @license http://framework.zend.com/license/new-bsd New BSD License | ||
*/ | ||
|
||
namespace Zend\Stdlib\Hydrator; | ||
|
||
/** | ||
* @category Zend | ||
* @package Zend_Stdlib | ||
* @subpackage Hydrator | ||
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) | ||
* @license http://framework.zend.com/license/new-bsd New BSD License | ||
*/ | ||
interface HydratorInterface | ||
{ | ||
/** | ||
* Extract values from an object | ||
* | ||
* @param object $object | ||
* @return array | ||
*/ | ||
public function extract($object); | ||
|
||
/** | ||
* Hydrate $object with the provided $data. | ||
* | ||
* @param array $data | ||
* @param object $object | ||
* @return void | ||
*/ | ||
public function hydrate(array $data, $object); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
<?php | ||
/** | ||
* Zend Framework | ||
* | ||
* LICENSE | ||
* | ||
* This source file is subject to the new BSD license that is bundled | ||
* with this package in the file LICENSE.txt. | ||
* It is also available through the world-wide-web at this URL: | ||
* http://framework.zend.com/license/new-bsd | ||
* If you did not receive a copy of the license and are unable to | ||
* obtain it through the world-wide-web, please send an email | ||
* to license@zend.com so we can send you a copy immediately. | ||
* | ||
* @category Zend | ||
* @package Zend_Stdlib | ||
* @subpackage Hydrator | ||
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) | ||
* @license http://framework.zend.com/license/new-bsd New BSD License | ||
*/ | ||
|
||
namespace Zend\Stdlib\Hydrator; | ||
|
||
use Zend\Stdlib\Exception; | ||
|
||
/** | ||
* @category Zend | ||
* @package Zend_Stdlib | ||
* @subpackage Hydrator | ||
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) | ||
* @license http://framework.zend.com/license/new-bsd New BSD License | ||
*/ | ||
class ObjectProperty implements HydratorInterface | ||
{ | ||
/** | ||
* Extract values from an object | ||
* | ||
* Extracts the accessible non-static properties of the given $object. | ||
* | ||
* @param object $object | ||
* @return array | ||
* @throws Exception\BadMethodCallException for a non-object $object | ||
*/ | ||
public function extract($object) | ||
{ | ||
if (!is_object($object)) { | ||
throw new Exception\BadMethodCallException(sprintf( | ||
'%s expects the provided $object to be a PHP object)', | ||
__METHOD__ | ||
)); | ||
} | ||
|
||
return get_object_vars($object); | ||
} | ||
|
||
/** | ||
* Hydrate an object by populating public properties | ||
* | ||
* Hydrates an object by setting public properties of the object. | ||
* | ||
* @param array $data | ||
* @param object $object | ||
* @return void | ||
* @throws Exception\BadMethodCallException for a non-object $object | ||
*/ | ||
public function hydrate(array $data, $object) | ||
{ | ||
if (!is_object($object)) { | ||
throw new Exception\BadMethodCallException(sprintf( | ||
'%s expects the provided $object to be a PHP object)', | ||
__METHOD__ | ||
)); | ||
} | ||
foreach ($data as $property => $value) { | ||
$object->$property = $value; | ||
} | ||
} | ||
} |