Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Docker-in-Docker (DinD) capabilities of public runners deactivated.
More info
Open sidebar
OpsPortal
lavoisiercli
Commits
080b1385
Commit
080b1385
authored
Oct 25, 2014
by
Olivier Lequeux
Browse files
fis SensioLabsInsight items
parent
eb7d993b
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
35 additions
and
20 deletions
+35
-20
composer.json
composer.json
+1
-0
src/Lavoisier/Exceptions/CurlException.php
src/Lavoisier/Exceptions/CurlException.php
+1
-1
src/Lavoisier/Hydrators/DefaultHydrator.php
src/Lavoisier/Hydrators/DefaultHydrator.php
+0
-2
src/Lavoisier/Hydrators/EntriesHydrator.php
src/Lavoisier/Hydrators/EntriesHydrator.php
+1
-3
src/Lavoisier/Hydrators/SimpleXMLHydrator.php
src/Lavoisier/Hydrators/SimpleXMLHydrator.php
+1
-4
src/Lavoisier/Query.php
src/Lavoisier/Query.php
+22
-8
tests/EntriesTest.php
tests/EntriesTest.php
+1
-2
tests/QueryTest.php
tests/QueryTest.php
+8
-0
No files found.
composer.json
View file @
080b1385
{
"name"
:
"ccin2p3/lavoisiercli"
,
"description"
:
"Lavoisier client"
,
"license"
:
"proprietary"
,
"authors"
:
[
{
"name"
:
"Olivier Lequeux"
,
...
...
src/Lavoisier/Exceptions/
cURL
Exception.php
→
src/Lavoisier/Exceptions/
Curl
Exception.php
View file @
080b1385
...
...
@@ -4,7 +4,7 @@ namespace Lavoisier\Exceptions;
use
\
Lavoisier\Query
;
class
cUR
LException
extends
\
Exception
class
Curl
LException
extends
\
Exception
{
private
$userMessage
=
null
;
...
...
src/Lavoisier/Hydrators/DefaultHydrator.php
View file @
080b1385
...
...
@@ -2,8 +2,6 @@
namespace
Lavoisier\Hydrators
;
use
\
Lavoisier\Hydrators\IHydrator
;
class
DefaultHydrator
implements
IHydrator
{
public
function
hydrate
(
$str
)
{
...
...
src/Lavoisier/Hydrators/EntriesHydrator.php
View file @
080b1385
...
...
@@ -2,9 +2,7 @@
namespace
Lavoisier\Hydrators
;
use
\
Lavoisier\Hydrators\IHydrator
;
use
\
Lavoisier\Entries\IEntries
;
use
\
Lavoisier\Entries\Entries
;
class
EntriesHydrator
implements
IHydrator
{
...
...
@@ -77,7 +75,7 @@ class EntriesHydrator implements IHydrator
}
}
else
{
$str
=
strval
(
$sxi
->
current
());
if
(
$this
->
value_as_key
==
true
)
{
if
(
$this
->
value_as_key
==
=
true
)
{
$key
=
$str
;
}
if
(
$key
===
null
)
{
...
...
src/Lavoisier/Hydrators/SimpleXMLHydrator.php
View file @
080b1385
...
...
@@ -7,12 +7,10 @@ use \Lavoisier\Entries\Entries;
class
SimpleXMLHydrator
implements
IHydrator
{
private
$prefix
;
private
$ns
;
function
__construct
()
{
$this
->
prefix
=
''
;
$this
->
ns
=
''
;
}
public
function
hydrate
(
$str
)
...
...
@@ -31,10 +29,9 @@ class SimpleXMLHydrator implements IHydrator
return
$sxObject
;
}
public
function
registerNamespace
(
$prefix
,
$ns
)
public
function
registerNamespace
(
$prefix
)
{
$this
->
prefix
=
$prefix
;
$this
->
ns
=
$ns
;
}
public
function
registerEntriesNamespace
(
$useLavoisierXMLNS
=
true
)
...
...
src/Lavoisier/Query.php
View file @
080b1385
...
...
@@ -17,7 +17,7 @@ class Query
{
static
private
$queryTemplates
;
private
$
is_
secure
;
private
$secure
Mode
;
private
$schema
;
private
$hostname
;
private
$port
;
...
...
@@ -41,7 +41,7 @@ class Query
public
function
__construct
(
$hostname
,
$view
=
''
,
$operation
=
'lavoisier'
,
$accept
=
'xml'
)
{
$this
->
set
Is
Secure
(
false
);
$this
->
setSecure
Mode
(
false
);
$this
->
hostname
=
$hostname
;
$this
->
port
=
'8080'
;
$this
->
operation
=
$operation
;
...
...
@@ -56,7 +56,8 @@ class Query
'lavoisier'
=>
"%s%s:%s/%s/%s%s%saccept=%s"
,
'lavoisier_base'
=>
"%s%s:%s/%s/%s%s"
,
'notify'
=>
"%s%s:%s/%s/%s"
,
'resources'
=>
"%s%s:%s/%s/%s"
'resources'
=>
"%s%s:%s/%s/%s"
,
'console'
=>
'%s%s:%s/%s'
);
$this
->
hydrator
=
new
DefaultHydrator
();
...
...
@@ -67,10 +68,10 @@ class Query
}
public
function
set
Is
Secure
(
$is_secure
)
public
function
setSecure
Mode
(
$is_secure
)
{
$this
->
is_
secure
=
$is_secure
;
if
(
$this
->
is_
secure
===
true
)
{
$this
->
secure
Mode
=
$is_secure
;
if
(
$this
->
secure
Mode
===
true
)
{
$this
->
schema
=
'https://'
;
}
else
{
$this
->
schema
=
'http://'
;
...
...
@@ -104,7 +105,7 @@ class Query
public
function
setMethod
(
$method
)
{
if
((
$method
===
'GET'
)
or
(
$method
===
'POST'
))
{
if
((
$method
===
'GET'
)
||
(
$method
===
'POST'
))
{
$this
->
method
=
$method
;
}
else
{
...
...
@@ -154,6 +155,19 @@ class Query
}
}
public
function
isInstanceRunning
()
{
$ch
=
curl_init
((
$this
->
getUrl
(
false
,
"console"
)));
curl_setopt
(
$ch
,
CURLOPT_CONNECT_ONLY
,
true
);
curl_exec
(
$ch
);
$response
=
curl_getinfo
(
$ch
);
$response
[
'last_curl_error'
]
=
curl_error
(
$ch
);
curl_close
(
$ch
);
return
empty
(
$response
[
'last_curl_error'
]);
}
public
function
curl
()
{
// init curl session
...
...
tests/EntriesTest.php
View file @
080b1385
...
...
@@ -37,8 +37,7 @@ class EntriesTest extends \PHPUnit_Framework_TestCase
$input
=
file_get_contents
(
dirname
(
__FILE__
)
.
'/Resources/tickets.xml'
);
$hydrator
=
new
\
Lavoisier\Hydrators\EntriesHydrator
(
"\TicketingSystem\Ticket\GgusFields"
);
$coll
=
$hydrator
->
hydrate
(
$input
);
//print_r($coll);
$hydrator
->
hydrate
(
$input
);
}
...
...
tests/QueryTest.php
View file @
080b1385
...
...
@@ -82,4 +82,12 @@ class QueryTest extends \PHPUnit_Framework_TestCase
}
public
function
testIsRunning
()
{
$q
=
new
Query
(
"nohost"
);
$this
->
assertEquals
(
"http://nohost:8080/lavoisier"
,
$q
->
getUrl
(
false
,
"console"
));
$this
->
assertEquals
(
false
,
$q
->
isInstanceRunning
());
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment