Skip to content

Commit

Permalink
Class headers and PSR 1+2 formatting fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
allebb committed Feb 21, 2016
1 parent 087f149 commit bfbe843
Show file tree
Hide file tree
Showing 18 changed files with 1,067 additions and 916 deletions.
1 change: 0 additions & 1 deletion examples/CheckServiceStatus.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
* An example of using Senitor to check the current status of services and the
* server uptime.
*/

// Set custom cURL options such as ignore invalid SSL certs or forward proxy server config.
// See: http://guzzle.readthedocs.org/en/latest/clients.html#request-options
$http_options = [
Expand Down
1 change: 0 additions & 1 deletion examples/CheckUsernameExists.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@

// Enable Debugging mode? - Will output the XML response from the Sentora server.
//$xmws_session->debugMode();

// Send the request and lets get the response object so we can use it to output our results.
$response = $xmws_session->send();

Expand Down
1 change: 0 additions & 1 deletion examples/CreateNewAccount.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@

// Enable Debugging mode? - Will output the XML response from the Sentora server.
//$xmws_session->debugMode();

// Send the request and lets get the response object so we can use it to output our results.
$response = $xmws_session->send();

Expand Down
1 change: 0 additions & 1 deletion examples/ListAllDomains.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@

// Check the repsonse output with a simple var_dump() call:
//var_dump($domains->asJson());

// Lets create an HTML table to contain our results.
$domains_html = "<h1>Domains</h1>"
. "<table>"
Expand Down
3 changes: 1 addition & 2 deletions examples/ListAllPackages.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,8 @@

// Enable Debugging mode? - Will output the XML response from the Sentora server.
//$xmws_session->debugMode();

// Send the request and lets get the response object so we can use it to output our results.
$response = $xmws_session->send();

// For demonstration purposes lets just var_dump() the contents as an array...
var_dump($response->asArray());
var_dump($response->asArray());
3 changes: 1 addition & 2 deletions examples/ListAllUsers.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,8 @@

// Enable Debugging mode? - Will output the XML response from the Sentora server.
// $xmws_session->debugMode();

// Send the request and lets get the response object so we can use it to output our results.
$response = $xmws_session->send();

// For demonstration purposes lets just var_dump() the contents as an array...
var_dump($response->asArray());
var_dump($response->asArray());
123 changes: 68 additions & 55 deletions src/Entities/AuthBlock.php
Original file line number Diff line number Diff line change
@@ -1,55 +1,68 @@
<?php namespace Ballen\Senitor\Entities;

use Ballen\Senitor\Entities\Target;

class AuthBlock
{

/**
* Object storage for XMWS Target Entity.
* @var \Ballen\Senitor\Entities\Target
*/
private $target;

public function __construct(Target $target)
{
$this->target = $target;
}

/**
* Retrieve the XML authentication block for the XMWS XML request.
* @return string
*/
public function getXmlBlock()
{
return $this->build();
}

/**
* Builds the XML configuration block for the XMWS transmission message.
* @return string
*/
private function build()
{
$conflines = [
'apikey' => $this->target->getApiKey(),
'authuser' => $this->target->getUser(),
'authpass' => $this->target->getPassword(),
];

$xmlcontent = "";
foreach ($conflines as $ckey => $cvalue) {
$xmlcontent .= "<{$ckey}>{$cvalue}</{$ckey}>" . PHP_EOL;
}
return $xmlcontent;
}

/**
* Returns the generated XML auth block tags.
* @return string
*/
public function __toString()
{
return $this->getXmlBlock();
}
}
<?php

namespace Ballen\Senitor\Entities;

use Ballen\Senitor\Entities\Target;

/**
* Senitor
*
* Senitor is a PHP API client for the Sentora Web Hosting Panel Web Service Layer (XMWS)
*
* @author Bobby Allen <ballen@bobbyallen.me>
* @license https://github.com/bobsta63/senitor/blob/master/LICENSE
* @link https://github.com/bobsta63/senitor
* @link http://www.bobbyallen.me
*
*/
class AuthBlock
{

/**
* Object storage for XMWS Target Entity.
* @var \Ballen\Senitor\Entities\Target
*/
private $target;

public function __construct(Target $target)
{
$this->target = $target;
}

/**
* Retrieve the XML authentication block for the XMWS XML request.
* @return string
*/
public function getXmlBlock()
{
return $this->build();
}

/**
* Builds the XML configuration block for the XMWS transmission message.
* @return string
*/
private function build()
{
$conflines = [
'apikey' => $this->target->getApiKey(),
'authuser' => $this->target->getUser(),
'authpass' => $this->target->getPassword(),
];

$xmlcontent = "";
foreach ($conflines as $ckey => $cvalue) {
$xmlcontent .= "<{$ckey}>{$cvalue}</{$ckey}>" . PHP_EOL;
}
return $xmlcontent;
}

/**
* Returns the generated XML auth block tags.
* @return string
*/
public function __toString()
{
return $this->getXmlBlock();
}
}

0 comments on commit bfbe843

Please sign in to comment.