Skip to content

Commit

Permalink
#6 recover resource classes
Browse files Browse the repository at this point in the history
  • Loading branch information
Bui Sy Nguyen committed Apr 29, 2016
1 parent ce29bfd commit 551ea90
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 1 deletion.
42 changes: 42 additions & 0 deletions fproject/Zend/Amf/Parse/Resource/Stream.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?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 [email protected] so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Amf
* @subpackage Parse
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id$
*/

/**
* This class will convert stream resource to string by just reading it
*
* @package Zend_Amf
* @subpackage Parse
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Amf_Parse_Resource_Stream
{
/**
* Parse resource into string
*
* @param resource $resource Stream resource
* @return array
*/
public function parse($resource) {
return stream_get_contents($resource);
}
}
2 changes: 1 addition & 1 deletion fproject/Zend/Amf/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ class Zend_Amf_Server
*/
public function __construct()
{
TypeLoader::setResourceLoader(new ResourceLoader());
TypeLoader::setResourceLoader(new ResourceLoader(array("Zend_Amf_Parse_Resource" => "Zend/Amf/Parse/Resource")));
}

/**
Expand Down
36 changes: 36 additions & 0 deletions tests/Zend/Amf/Resources/StreamContext.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?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 [email protected] so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Amf
* @subpackage UnitTests
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id$
*/

/**
* @category Zend
* @package Zend_Amf
* @subpackage UnitTests
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Amf_Parse_Resource_StreamContext
{
public function parse($resource)
{
return stream_context_get_options($resource);
}
}

0 comments on commit 551ea90

Please sign in to comment.