Unverified Commit 22d43da7 authored by Nathan Van Overloop's avatar Nathan Van Overloop
Browse files

centralnic/issues#3926: fix codestyle

parent ae64058c
**/.php_cs.cache
......@@ -2,7 +2,6 @@
class Net_EPP
{
/**
* load a class by giving it's short name
* @return boolean
......@@ -12,7 +11,7 @@ class Net_EPP
$prefix = __CLASS__.'_';
if ($prefix == substr($class, 0, strlen($prefix))) {
$basedir=dirname(dirname(__FILE__));
$basedir = dirname(dirname(__FILE__));
syslog(LOG_INFO, "class name is {$class} from dir {$basedir}");
$file = $basedir.'/'.str_replace('_', '/', $class).'.php';
......
<?php
/**
* @package Net_EPP
*/
abstract class Net_EPP_Frame extends DomDocument {
/**
* @package Net_EPP
*/
abstract class Net_EPP_Frame extends DomDocument
{
const EPP_URN = 'urn:ietf:params:xml:ns:epp-1.0';
const SCHEMA_URI = 'http://www.w3.org/2001/XMLSchema-instance';
const TEMPLATE = '<epp xmlns="urn:ietf:params:xml:ns:epp-1.0"></epp>';
const EPP_URN = 'urn:ietf:params:xml:ns:epp-1.0';
const SCHEMA_URI = 'http://www.w3.org/2001/XMLSchema-instance';
const TEMPLATE = '<epp xmlns="urn:ietf:params:xml:ns:epp-1.0"></epp>';
public function __construct($type)
{
parent::__construct('1.0', 'UTF-8');
function __construct($type) {
parent::__construct('1.0', 'UTF-8');
$this->loadXML(self::TEMPLATE);
$this->loadXML(self::TEMPLATE);
$type = strtolower($type);
if (!in_array($type, array('hello', 'greeting', 'command', 'response'))) {
trigger_error("Invalid argument value '$type' for \$type", E_USER_ERROR);
}
$type = strtolower($type);
if (!in_array($type, array('hello', 'greeting', 'command', 'response'))) trigger_error("Invalid argument value '$type' for \$type", E_USER_ERROR);
$this->epp = $this->firstChild;
$this->body = $this->createElement($type);
$this->epp->appendChild($this->body);
}
$this->epp = $this->firstChild;
$this->body = $this->createElement($type);
$this->epp->appendChild($this->body);
}
function friendly() {
return str_replace('><', ">\n<", $this->saveXML());
}
}
?>
public function friendly()
{
return str_replace('><', ">\n<", $this->saveXML());
}
}
<?php
/**
* @package Net_EPP
*/
class Net_EPP_Frame_Command extends Net_EPP_Frame {
/**
* @package Net_EPP
*/
class Net_EPP_Frame_Command extends Net_EPP_Frame
{
public function __construct($command, $type = "")
{
$this->type = $type;
$command = strtolower($command);
if (!in_array($command, array('check', 'info', 'create', 'update', 'delete', 'renew', 'transfer', 'poll', 'login', 'logout'))) {
trigger_error("Invalid argument value '$command' for \$command", E_USER_ERROR);
}
parent::__construct('command');
function __construct($command, $type="") {
$this->type = $type;
$command = strtolower($command);
if (!in_array($command, array('check', 'info', 'create', 'update', 'delete', 'renew', 'transfer', 'poll', 'login', 'logout'))) trigger_error("Invalid argument value '$command' for \$command", E_USER_ERROR);
parent::__construct('command');
$this->command = $this->createElement($command);
$this->body->appendChild($this->command);
$this->command = $this->createElement($command);
$this->body->appendChild($this->command);
if (!empty($this->type)) {
$this->payload = $this->createElementNS(
Net_EPP_ObjectSpec::xmlns($this->type),
$this->type.':'.$command
);
if (!empty($this->type)) {
$this->payload = $this->createElementNS(
Net_EPP_ObjectSpec::xmlns($this->type),
$this->type.':'.$command
);
$this->command->appendChild($this->payload);
}
}
$this->command->appendChild($this->payload);
}
}
public function addclTRID($id)
{
$this->clTRID = $this->createElement('clTRID');
$this->clTRID->appendChild($this->createTextNode($id));
$this->body->appendChild($this->clTRID);
}
function addclTRID($id) {
$this->clTRID = $this->createElement('clTRID');
$this->clTRID->appendChild($this->createTextNode($id));
$this->body->appendChild($this->clTRID);
}
public function addObjectProperty($name, $value = null)
{
$element = $this->createObjectPropertyElement($name);
$this->payload->appendChild($element);
function addObjectProperty($name, $value=NULL) {
$element = $this->createObjectPropertyElement($name);
$this->payload->appendChild($element);
if ($value instanceof DomNode) {
$element->appendChild($value);
} elseif (isset($value)) {
$element->appendChild($this->createTextNode($value));
}
return $element;
}
if ($value instanceof DomNode) {
$element->appendChild($value);
public function createObjectPropertyElement($name, $type = null)
{
$ns_type = isset($type) ? $type : $this->type;
$ns = !empty($ns_type) ? $ns_type.':'.$name : $name;
return $this->createElementNS(
Net_EPP_ObjectSpec::xmlns($ns_type),
$ns
);
}
} elseif (isset($value)) {
$element->appendChild($this->createTextNode($value));
}
return $element;
}
function createObjectPropertyElement($name, $type=NULL) {
$ns_type = isset($type) ? $type : $this->type;
$ns = !empty($ns_type) ? $ns_type.':'.$name : $name;
return $this->createElementNS(
Net_EPP_ObjectSpec::xmlns($ns_type), $ns
);
}
function createExtension() {
$this->extension = $this->createElement('extension');
$this->body->appendChild($this->extension);
}
public function createExtension()
{
$this->extension = $this->createElement('extension');
$this->body->appendChild($this->extension);
}
/**
* Creates an extension element with the option of specifying a custom namespace
* Creates an extension element with the option of specifying a custom namespace
* @param $ext
* @param $command
* @param null $version *
* @param null $version *
*/
function createExtensionElement($ext, $command, $version=null) {
$this->extension->payload = $this->createElementNS(
Net_EPP_ObjectSpec::xmlns($version !== null ? $version : $ext),
$ext.':'.$command
);
$this->extension->appendChild($this->extension->payload);
}
}
?>
public function createExtensionElement($ext, $command, $version = null)
{
$this->extension->payload = $this->createElementNS(
Net_EPP_ObjectSpec::xmlns($version !== null ? $version : $ext),
$ext.':'.$command
);
$this->extension->appendChild($this->extension->payload);
}
}
<?php
/**
* @package Net_EPP
*/
abstract class Net_EPP_Frame_Command_Check extends Net_EPP_Frame_Command {
/**
* @package Net_EPP
*/
abstract class Net_EPP_Frame_Command_Check extends Net_EPP_Frame_Command
{
public function __construct($type)
{
parent::__construct('check', $type);
}
function __construct($type) {
parent::__construct('check', $type);
}
function addObject($object) {
$type = strtolower(str_replace(__CLASS__.'_', '', get_class($this)));
$this->payload->appendChild($this->createElementNS(
Net_EPP_ObjectSpec::xmlns($type),
$type.':'.Net_EPP_ObjectSpec::id($type),
$object
));
}
}
?>
public function addObject($object)
{
$type = strtolower(str_replace(__CLASS__.'_', '', get_class($this)));
$this->payload->appendChild($this->createElementNS(
Net_EPP_ObjectSpec::xmlns($type),
$type.':'.Net_EPP_ObjectSpec::id($type),
$object
));
}
}
<?php
/**
* @package Net_EPP
*/
class Net_EPP_Frame_Command_Check_Contact extends Net_EPP_Frame_Command_Check {
function __construct() {
parent::__construct('contact');
}
}
?>
/**
* @package Net_EPP
*/
class Net_EPP_Frame_Command_Check_Contact extends Net_EPP_Frame_Command_Check
{
public function __construct()
{
parent::__construct('contact');
}
}
<?php
/**
* @package Net_EPP
*/
class Net_EPP_Frame_Command_Check_Domain extends Net_EPP_Frame_Command_Check {
function __construct() {
parent::__construct('domain');
}
}
?>
/**
* @package Net_EPP
*/
class Net_EPP_Frame_Command_Check_Domain extends Net_EPP_Frame_Command_Check
{
public function __construct()
{
parent::__construct('domain');
}
}
<?php
/**
* @package Net_EPP
*/
class Net_EPP_Frame_Command_Check_Host extends Net_EPP_Frame_Command_Check {
function __construct() {
parent::__construct('host');
}
}
?>
/**
* @package Net_EPP
*/
class Net_EPP_Frame_Command_Check_Host extends Net_EPP_Frame_Command_Check
{
public function __construct()
{
parent::__construct('host');
}
}
<?php
/**
* @package Net_EPP
*/
class Net_EPP_Frame_Command_Create extends Net_EPP_Frame_Command {
function __construct($type) {
$this->type = $type;
parent::__construct('create', $type);
}
}
?>
/**
* @package Net_EPP
*/
class Net_EPP_Frame_Command_Create extends Net_EPP_Frame_Command
{
public function __construct($type)
{
$this->type = $type;
parent::__construct('create', $type);
}
}
<?php
/**
* @package Net_EPP
*/
class Net_EPP_Frame_Command_Create_Contact extends Net_EPP_Frame_Command_Create {
function __construct() {
parent::__construct('contact');
}
}
?>
/**
* @package Net_EPP
*/
class Net_EPP_Frame_Command_Create_Contact extends Net_EPP_Frame_Command_Create
{
public function __construct()
{
parent::__construct('contact');
}
}
<?php
/**
* @package Net_EPP
*/
class Net_EPP_Frame_Command_Create_Domain extends Net_EPP_Frame_Command_Create {
function __construct() {
parent::__construct('domain');
}
}
?>
/**
* @package Net_EPP
*/
class Net_EPP_Frame_Command_Create_Domain extends Net_EPP_Frame_Command_Create
{
public function __construct()
{
parent::__construct('domain');
}
}
<?php
/**
* @package Net_EPP
*/
class Net_EPP_Frame_Command_Create_Host extends Net_EPP_Frame_Command_Create {
function __construct() {
parent::__construct('host');
}
}
?>
/**
* @package Net_EPP
*/
class Net_EPP_Frame_Command_Create_Host extends Net_EPP_Frame_Command_Create
{
public function __construct()
{
parent::__construct('host');
}
}
<?php
/**
* @package Net_EPP
*/
class Net_EPP_Frame_Command_Delete extends Net_EPP_Frame_Command {
function __construct($type) {
$this->type = $type;
parent::__construct('delete', $type);
}
}
?>
/**
* @package Net_EPP
*/
class Net_EPP_Frame_Command_Delete extends Net_EPP_Frame_Command
{
public function __construct($type)
{
$this->type = $type;
parent::__construct('delete', $type);
}
}
<?php
/**
* @package Net_EPP
*/
class Net_EPP_Frame_Command_Delete_Contact extends Net_EPP_Frame_Command_Delete {
function __construct() {
parent::__construct('contact');
}
}
?>
/**
* @package Net_EPP
*/
class Net_EPP_Frame_Command_Delete_Contact extends Net_EPP_Frame_Command_Delete
{
public function __construct()
{
parent::__construct('contact');
}
}
<?php
/**
* @package Net_EPP
*/
class Net_EPP_Frame_Command_Delete_Domain extends Net_EPP_Frame_Command_Delete {
function __construct() {
parent::__construct('domain');
}
}
?>
/**
* @package Net_EPP
*/
class Net_EPP_Frame_Command_Delete_Domain extends Net_EPP_Frame_Command_Delete
{
public function __construct()
{
parent::__construct('domain');
}
}
<?php
/**
* @package Net_EPP
*/
class Net_EPP_Frame_Command_Delete_Host extends Net_EPP_Frame_Command_Delete {
function __construct() {
parent::__construct('host');
}
}
?>
/**
* @package Net_EPP
*/
class Net_EPP_Frame_Command_Delete_Host extends Net_EPP_Frame_Command_Delete
{
public function __construct()
{
parent::__construct('host');
}
}
<?php
/**
* @package Net_EPP
*/
abstract class Net_EPP_Frame_Command_Info extends Net_EPP_Frame_Command {
/**
* @package Net_EPP
*/
abstract class Net_EPP_Frame_Command_Info extends Net_EPP_Frame_Command
{
public function __construct($type)
{
parent::__construct('info', $type);
}
function __construct($type) {
parent::__construct('info', $type);
}
public function setObject($object)
{
$type = strtolower(str_replace(__CLASS__.'_', '', get_class($this)));
foreach ($this->payload->childNodes as $child) {
$this->payload->removeChild($child);
}
$this->payload->appendChild($this->createElementNS(
Net_EPP_ObjectSpec::xmlns($type),
$type.':'.Net_EPP_ObjectSpec::id($type),
$object
));
}
function setObject($object) {
$type = strtolower(str_replace(__CLASS__.'_', '', get_class($this)));
foreach ($this->payload->childNodes as $child) $this->payload->removeChild($child);
$this->payload->appendChild($this->createElementNS(
Net_EPP_ObjectSpec::xmlns($type),
$type.':'.Net_EPP_ObjectSpec::id($type),
$object
));
}
function setAuthInfo($authInfo) {
$el = $this->createObjectPropertyElement('authInfo');
$el->appendChild($this->createObjectPropertyElement('pw'));
$el->firstChild->appendChild($this->createTextNode($authInfo));
$this->payload->appendChild($el);
}
}
?>
public function setAuthInfo($authInfo)
{
$el = $this->createObjectPropertyElement('authInfo');
$el->appendChild($this->createObjectPropertyElement('pw'));
$el->firstChild->appendChild($this->createTextNode($authInfo));
$this->payload->appendChild($el);
}
}
<?php
/**
* @package Net_EPP
*/
class Net_EPP_Frame_Command_Info_Contact extends Net_EPP_Frame_Command_Info {
function __construct() {
parent::__construct('contact');
}
}
?>
/**
* @package Net_EPP
*/
class Net_EPP_Frame_Command_Info_Contact extends Net_EPP_Frame_Command_Info
{
public function __construct()
{
parent::__construct('contact');
}