-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from LeaseWeb/php7
PHP7 only support
- Loading branch information
Showing
52 changed files
with
3,289 additions
and
1,725 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 |
---|---|---|
|
@@ -2,3 +2,4 @@ | |
|
||
/vendor/ | ||
/build | ||
/.php_cs.cache |
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,5 @@ | ||
<?php | ||
|
||
$finder = PhpCsFixer\Finder::create()->in("src")->in("tests"); | ||
|
||
return PhpCsFixer\Config::create()->setRules(array('@PSR2' => true, '@Symfony' => true, 'concat_space' => false))->setFinder($finder); |
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
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,17 +1,74 @@ | ||
#!/usr/bin/env php | ||
<?php | ||
|
||
require __DIR__.'/../src/bootstrap.php'; | ||
require_once __DIR__.'/../vendor/autoload.php'; | ||
|
||
use PhpSoapClient\Compiler; | ||
use Symfony\Component\Finder\Finder; | ||
|
||
error_reporting(-1); | ||
ini_set('display_errors', 1); | ||
if (file_exists('soap_client.phar')) { | ||
unlink('soap_client.phar'); | ||
} | ||
|
||
function stripWhiteSpace($source) | ||
{ | ||
$output = ''; | ||
foreach (token_get_all($source) as $token) { | ||
if (is_string($token)) { | ||
$output .= $token; | ||
} elseif (in_array($token[0], array(T_COMMENT, T_DOC_COMMENT))) { | ||
$output .= str_repeat("\n", substr_count($token[1], "\n")); | ||
} elseif (T_WHITESPACE === $token[0]) { | ||
// reduce wide spaces | ||
$whitespace = preg_replace('{[ \t]+}', ' ', $token[1]); | ||
// normalize newlines to \n | ||
$whitespace = preg_replace('{(?:\r\n|\r|\n)}', "\n", $whitespace); | ||
// trim leading spaces | ||
$whitespace = preg_replace('{\n +}', "\n", $whitespace); | ||
$output .= $whitespace; | ||
} else { | ||
$output .= $token[1]; | ||
} | ||
} | ||
|
||
return $output; | ||
} | ||
|
||
echo "==> Creating phar in soap_client.phar\n"; | ||
|
||
$phar = new \Phar('soap_client.phar', 0, 'soap_client.phar'); | ||
$phar->setSignatureAlgorithm(\Phar::SHA1); | ||
$phar->startBuffering(); | ||
|
||
try { | ||
$compiler = new Compiler(); | ||
$compiler->compile(); | ||
} catch (\Exception $e) { | ||
echo 'Failed to compile phar: ['.get_class($e).'] '.$e->getMessage().' at '.$e->getFile().':'.$e->getLine(); | ||
exit(1); | ||
$finder = new Finder(); | ||
$finder | ||
->files() | ||
->ignoreVCS(true) | ||
->in(__DIR__.'/../bin') | ||
->in(__DIR__.'/../config') | ||
->in(__DIR__.'/../src') | ||
->in(__DIR__.'/../vendor') | ||
->exclude('Tests') | ||
->exclude('tests') | ||
->name('*.php') | ||
->name('*.yml') | ||
->name('console'); | ||
|
||
foreach ($finder as $file) { | ||
$path = str_replace(dirname(__DIR__).DIRECTORY_SEPARATOR, '', $file->getRealPath()); | ||
$content = preg_replace('{^#!/usr/bin/env php\s*}', '', $file->getContents()); | ||
$phar->addFromString($path, stripWhiteSpace($content)); | ||
} | ||
|
||
$phar->setStub("#!/usr/bin/env php | ||
<?php | ||
Phar::mapPhar('soap_client.phar'); | ||
require 'phar://soap_client.phar/bin/console'; | ||
__HALT_COMPILER();"); | ||
|
||
$phar->stopBuffering(); | ||
$phar->compressFiles(\Phar::GZ); | ||
|
||
unset($phar); | ||
chmod('soap_client.phar', 0755); | ||
|
||
echo "==> Done creating phar archive\n"; |
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,25 @@ | ||
#!/usr/bin/env php | ||
<?php | ||
|
||
use Symfony\Component\Config\FileLocator; | ||
use Symfony\Component\Console\Input\ArgvInput; | ||
use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; | ||
|
||
set_time_limit(0); | ||
|
||
require_once __DIR__.'/../vendor/autoload.php'; | ||
|
||
$input = new ArgvInput(); | ||
$config = $input->getParameterOption(['--config', '-c'], $_SERVER['APP_CONFIG'] ?? 'soap_client.yml', true); | ||
|
||
$container = new ContainerBuilder(); | ||
$loader = new YamlFileLoader($container, new FileLocator(__DIR__.'/../config')); | ||
$loader->load('app.yml'); | ||
$loader->load('parameters.yml'); | ||
|
||
if (file_exists($config)) { | ||
$loader->load(realpath($config)); | ||
} | ||
|
||
$container->get('symfony.application')->run($input, $container->get('symfony.console_output')); |
This file was deleted.
Oops, something went wrong.
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,74 @@ | ||
#compdef soap_client | ||
|
||
_soap_client () { | ||
local curcontext="$curcontext" state line | ||
typeset -A opt_args | ||
|
||
local -a soap_client_commands | ||
soap_client_commands=( | ||
'call:Call the remote service with the `method` specified and output the reponse to stdout.' | ||
'list-methods:Get a list of available methods to call on the remote.' | ||
'request:Generate an xml formatted SOAP request for the given method and output to stdout.' | ||
'wsdl:Get the WSDL of a soap service.' | ||
) | ||
|
||
_arguments -C \ | ||
'--config=[The location to the configuration file]:filename:_files' \ | ||
'--endpoint=[Specify the url to the wsdl of the SOAP webservice to inspect]:args' \ | ||
'--proxy=[Use this proxy to connect to the SOAP web service]:args' \ | ||
'--quiet[Do not output any message]' \ | ||
'--cache[Enable caching of the wsdl]' \ | ||
'1: :{_describe "commands" soap_client_commands}' \ | ||
'*::args:->args' | ||
|
||
case $state in | ||
(args) | ||
case $line[1] in | ||
(call) | ||
_soap_client-call | ||
;; | ||
(request) | ||
_soap_client-request | ||
;; | ||
esac | ||
;; | ||
esac | ||
} | ||
|
||
_soap_client-call () { | ||
local curcontext="$curcontext" state line | ||
typeset -A opt_args | ||
|
||
_arguments -C \ | ||
"--editor[Open the request xml in your favorite $EDITOR before sending to the server]" \ | ||
"--xml[Output the results as xml. Otherwise output as an object]" \ | ||
'1: :_soap_client-methods' | ||
} | ||
|
||
_soap_client-request () { | ||
local curcontext="$curcontext" state line | ||
typeset -A opt_args | ||
|
||
_arguments -C \ | ||
'1: :_soap_client-methods' | ||
} | ||
|
||
_soap_client-methods () { | ||
local endpoint | ||
|
||
for token in $tokens; do | ||
if [[ "$token" =~ ^--endpoint=.* ]] | ||
then | ||
endpoint=$token | ||
break | ||
fi | ||
done | ||
|
||
[[ -z $endpoint ]] && return 1 | ||
|
||
local -a soap_client_methods | ||
soap_client_methods=($($name --cache ${endpoint//\"/} list-methods)) | ||
_describe "methods" soap_client_methods | ||
} | ||
|
||
_soap_client "$@" |
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
Oops, something went wrong.