-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
39 changed files
with
867 additions
and
511 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 |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the OverblogThriftBundle package. | ||
* | ||
* (c) Overblog <http://github.com/overblog/> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
require_once __DIR__.'/vendor/sllh/php-cs-fixer-styleci-bridge/autoload.php'; | ||
|
||
use SLLH\StyleCIBridge\ConfigBridge; | ||
use Symfony\CS\Fixer\Contrib\HeaderCommentFixer; | ||
|
||
$header = <<<EOF | ||
This file is part of the OverblogThriftBundle package. | ||
(c) Overblog <http://github.com/overblog/> | ||
For the full copyright and license information, please view the LICENSE | ||
file that was distributed with this source code. | ||
EOF; | ||
|
||
// PHP-CS-Fixer 1.x | ||
if (method_exists('Symfony\CS\Fixer\Contrib\HeaderCommentFixer', 'getHeader')) { | ||
HeaderCommentFixer::setHeader($header); | ||
} | ||
|
||
$config = ConfigBridge::create(); | ||
|
||
// PHP-CS-Fixer 2.x | ||
if (method_exists($config, 'setRules')) { | ||
$config->setRules(array_merge($config->getRules(), [ | ||
'header_comment' => ['header' => $header] | ||
])); | ||
} | ||
|
||
return $config | ||
->setUsingCache(true) | ||
->fixers(array_merge($config->getFixers(), ['header_comment'])) | ||
; |
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,7 @@ | ||
preset: symfony | ||
enabled: | ||
- ordered_use | ||
- short_array_syntax | ||
|
||
disabled: | ||
- unalign_equals |
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,82 +1,87 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the OverblogThriftBundle package. | ||
* | ||
* (c) Overblog <http://github.com/overblog/> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
/** | ||
* Symfony extension for Thrift Extension | ||
* Symfony extension for Thrift Extension. | ||
* | ||
* @category Bundle | ||
* @package InternalApi | ||
* | ||
* @author Vincent Bouzeran <[email protected]> | ||
* @author Yannick Le Guédart <[email protected]> | ||
* @copyright 2011 Overblog | ||
*/ | ||
|
||
namespace Overblog\ThriftBundle\Api\Extensions; | ||
|
||
use Symfony\Component\DependencyInjection\ContainerInterface; | ||
|
||
/** | ||
* Symfony extension for Thrift Extension | ||
* Symfony extension for Thrift Extension. | ||
* | ||
* @category Bundle | ||
* @package InternalApi | ||
* @subpackage Base extension | ||
* | ||
* @author Vincent Bouzeran <[email protected]> | ||
* @author Yannick Le Guédart <[email protected]> | ||
*/ | ||
|
||
abstract class BaseExtension | ||
{ | ||
/** | ||
* Injected SF2 container | ||
* Injected SF2 container. | ||
* | ||
* @var type | ||
*/ | ||
protected $_container; | ||
|
||
/** | ||
* Thrift Factory | ||
* Thrift Factory. | ||
* | ||
* @var type | ||
*/ | ||
protected $factory; | ||
|
||
/** | ||
* Constructor | ||
* Constructor. | ||
* | ||
* @param ContainerInterface $container | ||
*/ | ||
|
||
public function __construct(ContainerInterface $container) | ||
{ | ||
$this->_container = $container; | ||
$this->factory = $container->get('thrift.factory'); | ||
} | ||
|
||
/** | ||
* Returns a service from the injected container | ||
* Returns a service from the injected container. | ||
* | ||
* @param string $service | ||
* | ||
* @return mixed | ||
*/ | ||
|
||
public function get($service) | ||
{ | ||
return $this->_container->get($service); | ||
} | ||
|
||
/** | ||
* Set a service to the injected container | ||
* Set a service to the injected container. | ||
* | ||
* @param string $id, The service id | ||
* @param mixed $service, The service | ||
* @param string $id, The service id | ||
* @param mixed $service, The service | ||
*/ | ||
|
||
public function set($id, $service) | ||
{ | ||
$this->_container->set($id, $service); | ||
} | ||
|
||
/** | ||
* Returns a parameter from the injected container | ||
* Returns a parameter from the injected container. | ||
* | ||
* @param string $name | ||
* | ||
|
@@ -88,13 +93,15 @@ public function getParameter($name) | |
} | ||
|
||
/** | ||
* Get instance of Thrift Model classes | ||
* @param string $classe | ||
* @param mixed $param | ||
* Get instance of Thrift Model classes. | ||
* | ||
* @param string $class | ||
* @param mixed $param | ||
* | ||
* @return mixed | ||
*/ | ||
public function getInstance($classe, $param = null) | ||
public function getInstance($class, $param = null) | ||
{ | ||
return $this->factory->getInstance($classe, $param); | ||
return $this->factory->getInstance($class, $param); | ||
} | ||
} |
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
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,54 +1,65 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the OverblogThriftBundle package. | ||
* | ||
* (c) Overblog <http://github.com/overblog/> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Overblog\ThriftBundle\Client; | ||
|
||
/** | ||
* Abstract class for create a client | ||
* Abstract class for create a client. | ||
* | ||
* @author Xavier HAUSHERR | ||
*/ | ||
|
||
abstract class Client | ||
{ | ||
/** | ||
* Config handler | ||
* Config handler. | ||
* | ||
* @var array | ||
*/ | ||
protected $config; | ||
|
||
/** | ||
* Socket instance | ||
* Socket instance. | ||
* | ||
* @var Thrift\Transport\TSocket | ||
*/ | ||
protected $socket; | ||
|
||
/** | ||
* Register dependencies | ||
* Register dependencies. | ||
* | ||
* @param array $config | ||
*/ | ||
public function __construct(Array $config) | ||
public function __construct(array $config) | ||
{ | ||
$this->config = $config; | ||
} | ||
|
||
/** | ||
* Return socket | ||
* Return socket. | ||
* | ||
* @return Thrift\Transport\TSocket | ||
*/ | ||
public function getSocket() | ||
{ | ||
if(is_null($this->socket)) | ||
{ | ||
if (is_null($this->socket)) { | ||
$this->socket = $this->createSocket(); | ||
} | ||
|
||
return $this->socket; | ||
} | ||
|
||
/** | ||
* Insctanciate socket | ||
* Insctanciate socket. | ||
* | ||
* @return Thrift\Transport\TSocket | ||
*/ | ||
abstract protected function createSocket(); | ||
} | ||
} |
Oops, something went wrong.