Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 9ba9d1ef2c
Fetching contributors…

Cannot retrieve contributors at this time

file 576 lines (576 sloc) 14.835 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576
<?php
/**
* File for XiWatchListsWsdlClass to communicate with SOAP service
* @date 08/07/2012
*/
/**
* File for XiWatchListsWsdlClass to communicate with SOAP service
* Documentation : This Web Service provides for the management of symbol-based watchlists.
* @date 08/07/2012
*/
class XiWatchListsWsdlClass extends stdClass implements ArrayAccess,Iterator,Countable
{
/**
* Option key to define WSDL url
* @var string
*/
const WSDL_URL = 'wsdl_url';
/**
* Option key to define WSDL login
* @var string
*/
const WSDL_LOGIN = 'wsdl_login';
/**
* Option key to define WSDL password
* @var string
*/
const WSDL_PASSWD = 'wsdl_password';
/**
* Option key to define WSDL trace option
* @var string
*/
const WSDL_TRACE = 'wsdl_trace';
/**
* Option key to define WSDL exceptions
* @var string
*/
const WSDL_EXCPTS = 'wsdl_exceptions';
/**
* Option key to define WSDL cache_wsdl
* @var string
*/
const WSDL_CACHE_WSDL = 'wsdl_cache_wsdl';
/**
* Option key to define WSDL stream_context
* @var string
*/
const WSDL_STREAM_CONTEXT = 'wsdl_stream_context';
/**
* Option key to define WSDL soap_version
* @var string
*/
const WSDL_SOAP_VERSION = 'wsdl_soap_version';
/**
* Option key to define WSDL compression
* @var string
*/
const WSDL_COMPRESSION = 'wsdl_compression';
/**
* Option key to define WSDL encoding
* @var string
*/
const WSDL_ENCODING = 'wsdl_encoding';
/**
* Option key to define WSDL connection_timeout
* @var string
*/
const WSDL_CONNECTION_TIMEOUT = 'wsdl_connection_timeout';
/**
* Option key to define WSDL typemap
* @var string
*/
const WSDL_TYPEMAP = 'wsdl_typemap';
/**
* Option key to define WSDL user_agent
* @var string
*/
const WSDL_USER_AGENT = 'wsdl_user_agent';
/**
* Option key to define WSDL features
* @var string
*/
const WSDL_FEATURES = 'wsdl_features';
/**
* Option key to define WSDL keep_alive
* @var string
*/
const WSDL_FKEEP_ALIVE = 'wsdl_keep_alive';
/**
* Objet de la classe SOAP permettant de faire les requetes SOAP
* @var SoapClient
*/
private static $soapClient;
/**
* Contains Soap call result
* @var mixed
*/
private $result;
/**
* Contains last errors
* @var array
*/
private $lastError;
/**
* Array that contains values when only one parameter is set when calling __construct method
* @var array
*/
private $internArrayToIterate;
/**
* Bool that tells if array is set or not
* @var bool
*/
private $internArrayToIterateIsArray;
/**
* Items index browser
* @var int
*/
private $internArrayToIterateOffset;
/**
* Constructor
* @uses XiWatchListsWsdlClass::setLastError()
* @uses XiWatchListsWsdlClass::initSoapClient()
* @uses XiWatchListsWsdlClass::initInternArrayToIterate()
* @uses XiWatchListsWsdlClass::_set()
* @param array values
* @return Lists
*/
public function __construct($_arrayOfValues = array())
{
$this->setLastError(array());
/**
* Init soap Client
* Set default values
*/
$this->initSoapClient($_arrayOfValues);
/**
* Init array of values if set
*/
$this->initInternArrayToIterate($_arrayOfValues);
/**
* Generic set methods
*/
if(is_array($_arrayOfValues) && count($_arrayOfValues))
{
foreach($_arrayOfValues as $name=>$value)
$this->_set($name,$value);
}
}
/**
* @return SoapClient
*/
public static function getSoapClient()
{
return self::$soapClient;
}
/**
* @param SoapClient $soapClient
*/
protected static function setSoapClient(SoapClient $_soapClient)
{
return (self::$soapClient = $_soapClient);
}
/**
* Init SoapClient
* @uses XiWatchListsWsdlClass::classMap()
* @uses XiWatchListsWsdlClass::getDefaultWsdlOptions()
* @param array WSDL options
*/
public function initSoapClient($_wsdlOptions)
{
if(class_exists('XiWatchListsClassMap',true))
{
$wsdlOptions = array();
$wsdlOptions['classmap'] = XiWatchListsClassMap::classMap();
$defaultWsdlOptions = self::getDefaultWsdlOptions();
foreach($defaultWsdlOptions as $optioName=>$optionValue)
{
if(array_key_exists($optioName,$_wsdlOptions) && !empty($_wsdlOptions[$optioName]))
$wsdlOptions[str_replace('wsdl_','',$optioName)] = $_wsdlOptions[$optioName];
elseif(!empty($optionValue))
$wsdlOptions[str_replace('wsdl_','',$optioName)] = $optionValue;
}
if(array_key_exists(str_replace('wsdl_','',self::WSDL_URL),$wsdlOptions))
{
$wsdlUrl = $wsdlOptions[str_replace('wsdl_','',self::WSDL_URL)];
unset($wsdlOptions[str_replace('wsdl_','',self::WSDL_URL)]);
self::setSoapClient(new SoapClient($wsdlUrl,$wsdlOptions));
}
}
}
/**
* Returns all default options values
* @uses XiWatchListsWsdlClass::WSDL_CACHE_WSDL
* @uses XiWatchListsWsdlClass::WSDL_COMPRESSION
* @uses XiWatchListsWsdlClass::WSDL_CONNECTION_TIMEOUT
* @uses XiWatchListsWsdlClass::WSDL_ENCODING
* @uses XiWatchListsWsdlClass::WSDL_EXCPTS
* @uses XiWatchListsWsdlClass::WSDL_FEATURES
* @uses XiWatchListsWsdlClass::WSDL_LOGIN
* @uses XiWatchListsWsdlClass::WSDL_PASSWD
* @uses XiWatchListsWsdlClass::WSDL_SOAP_VERSION
* @uses XiWatchListsWsdlClass::WSDL_STREAM_CONTEXT
* @uses XiWatchListsWsdlClass::WSDL_TRACE
* @uses XiWatchListsWsdlClass::WSDL_TYPEMAP
* @uses XiWatchListsWsdlClass::WSDL_URL
* @uses XiWatchListsWsdlClass::WSDL_USER_AGENT
* @return array
*/
public static function getDefaultWsdlOptions()
{
return array(
self::WSDL_CACHE_WSDL=>WSDL_CACHE_NONE,
self::WSDL_COMPRESSION=>null,
self::WSDL_CONNECTION_TIMEOUT=>null,
self::WSDL_ENCODING=>null,
self::WSDL_EXCPTS=>true,
self::WSDL_FEATURES=>null,
self::WSDL_LOGIN=>null,
self::WSDL_PASSWD=>null,
self::WSDL_SOAP_VERSION=>null,
self::WSDL_STREAM_CONTEXT=>null,
self::WSDL_TRACE=>true,
self::WSDL_TYPEMAP=>null,
self::WSDL_URL=>null,
self::WSDL_USER_AGENT=>null);
}
/**
* Alias to count
* @uses XiWatchListsWsdlClass::count()
* @return int
*/
public function length()
{
return $this->count();
}
/**
* Method returning item length, alias to length
* @uses XiWatchListsWsdlClass::internArrayToIterateIsArray()
* @uses XiWatchListsWsdlClass::getInternArrayToIterate()
* @return int
*/
public function count()
{
return $this->getInternArrayToIterateIsArray()?count($this->getInternArrayToIterate()):-1;
}
/**
* Returns the current element
* @uses XiWatchListsWsdlClass::offsetGet()
* @return mixed
*/
public function current()
{
return $this->offsetGet($this->internArrayToIterateOffset);
}
/**
* Moves the current position to the next element
* @uses XiWatchListsWsdlClass::getInternArrayToIterateOffset()
* @uses XiWatchListsWsdlClass::setInternArrayToIterateOffset()
* @return int
*/
public function next()
{
return $this->setInternArrayToIterateOffset($this->getInternArrayToIterateOffset() + 1);
}
/**
* Reset itemOffset
* @uses XiWatchListsWsdlClass::setInternArrayToIterateOffset()
* @return int
*/
public function rewind()
{
return $this->setInternArrayToIterateOffset(0);
}
/**
* Check if current itemOffset points to an existing item
* @uses XiWatchListsWsdlClass::getInternArrayToIterateOffset()
* @uses XiWatchListsWsdlClass::offsetExists()
* @return bool true|false
*/
public function valid()
{
return $this->offsetExists($this->getInternArrayToIterateOffset());
}
/**
* Returns current itemOffset value, alias to getInternArrayToIterateOffset
* @uses XiWatchListsWsdlClass::getInternArrayToIterateOffset()
* @return int
*/
public function key()
{
return $this->getInternArrayToIterateOffset();
}
/**
* Alias to offsetGet
* @see XiWatchListsWsdlClass::offsetGet()
* @uses XiWatchListsWsdlClass::offsetGet()
* @param int
* @return mixed
*/
public function item($_index)
{
return $this->offsetGet($_index);
}
/**
* Default method to add item to array
* @uses XiWatchListsWsdlClass::getAttributeName()
* @uses XiWatchListsWsdlClass::__toString()
* @uses XiWatchListsWsdlClass::_set()
* @uses XiWatchListsWsdlClass::_get()
* @uses XiWatchListsWsdlClass::setInternArrayToIterate()
* @uses XiWatchListsWsdlClass::setInternArrayToIterateIsArray()
* @uses XiWatchListsWsdlClass::setInternArrayToIterateOffset()
* @param mixed value
* @return bool true|false
*/
public function add($_item)
{
if($this->getAttributeName() != '' && strpos($this->__toString(),'ArrayOf') !== false)
{
/**
* init array
*/
if(!is_array($this->_get($this->getAttributeName())))
$this->_set($this->getAttributeName(),array());
/**
* current array
*/
$currentArray = $this->_get($this->getAttributeName());
array_push($currentArray,$_item);
$this->_set($this->getAttributeName(),$currentArray);
$this->setInternArrayToIterate($currentArray);
$this->setInternArrayToIterateIsArray(true);
$this->setInternArrayToIterateOffset(0);
return true;
}
return false;
}
/**
* Method to call when sending data to request for ArrayOf type classe
* @uses XiWatchListsWsdlClass::getAttributeName()
* @uses XiWatchListsWsdlClass::_get()
* @return mixed
*/
public function toSend()
{
if($this->getAttributeName() != '' && strpos($this->__toString(),'ArrayOf') !== false)
return $this->_get($this->getAttributeName());
else
return null;
}
/**
* Method returning the first item
* @uses XiWatchListsWsdlClass::item()
* @return mixed
*/
public function first()
{
return $this->item(0);
}
/**
* Method returning the last item
* @uses XiWatchListsWsdlClass::item()
* @uses XiWatchListsWsdlClass::length()
* @return mixed
*/
public function last()
{
return $this->item($this->length() - 1);
}
/**
* Method testing index in item
* @uses XiWatchListsWsdlClass::getInternArrayToIterateIsArray()
* @uses XiWatchListsWsdlClass::getInternArrayToIterate()
* @param int
* @return bool true|false
*/
public function offsetExists($_offset)
{
return ($this->getInternArrayToIterateIsArray() && array_key_exists($_offset,$this->getInternArrayToIterate()));
}
/**
* Method returning the item at "index" value
* @uses XiWatchListsWsdlClass::offsetExists()
* @param int
* @return mixed
*/
public function offsetGet($_offset)
{
return $this->offsetExists($_offset)?$this->internArrayToIterate[$_offset]:null;
}
/**
* Method useless but necessarly overriden, can't set
* @param null
* @param null
* @return null
*/
public function offsetSet($_offset,$_value)
{
return null;
}
/**
* Method useless but necessarly overriden, can't set
* @param null
* @param null
* @return null
*/
public function offsetUnset($_offset)
{
return null;
}
/**
* @return mixed
*/
public function getResult()
{
return $this->result;
}
/**
* @param mixed
* @return bool true
*/
protected function setResult($_result)
{
return ($this->result = $_result);
}
/**
* @return array
*/
public function getLastError()
{
return $this->lastError;
}
/**
* @param array
* @return array
*/
private function setLastError($_lastError)
{
return ($this->lastError = $_lastError);
}
/**
* Méthode permettant d'enregistrer les erreurs survenues lors des appels au service OVH
*
* @param string la méthode dnas laquelle est survenue l'erreur
* @param Soapault l'objet de l'erreur
* @return bool true
*/
protected function saveLastError($_methoName,SoapFault $_soapFault)
{
return ($this->lastError[$_methoName] = $_soapFault);
}
/**
* Méthode permettant de récupérer la dernière erreur relative à une méthode
*
* @param string le nom de la méthode
* @return SoapFault|null
*/
public function getLastErrorForMethod($_methoName)
{
return (is_array($this->lastError) && array_key_exists($_methoName,$this->lastError))?$this->lastError[$_methoName]:null;
}
/**
* @return array
*/
public function getInternArrayToIterate()
{
return $this->internArrayToIterate;
}
/**
* @param array $internArrayToIterate
*/
public function setInternArrayToIterate($_internArrayToIterate)
{
return ($this->internArrayToIterate = $_internArrayToIterate);
}
/**
* @return int
*/
public function getInternArrayToIterateOffset()
{
return $this->internArrayToIterateOffset;
}
/**
* Function to initiate internArrayToIterate
* @uses XiWatchListsWsdlClass::setInternArrayToIterate()
* @uses XiWatchListsWsdlClass::setInternArrayToIterateOffset()
* @uses XiWatchListsWsdlClass::setInternArrayToIterateIsArray()
* @uses XiWatchListsWsdlClass::getAttributeName()
* @uses XiWatchListsWsdlClass::initInternArrayToIterate()
* @uses XiWatchListsWsdlClass::__toString()
* @param array $_array
* @param bool $_interCall
*/
public function initInternArrayToIterate(array $_array = array(),$_interCall = false)
{
if(strpos($this->__toString(),'ArrayOf') !== false)
{
if(count($_array))
{
$this->setInternArrayToIterate($_array);
$this->setInternArrayToIterateOffset(0);
$this->setInternArrayToIterateIsArray(true);
}
elseif(!$_interCall && $this->getAttributeName() != '' && property_exists($this->__toString(),$this->getAttributeName()))
$this->initInternArrayToIterate($this->_get($this->getAttributeName()),true);
}
}
/**
* @param int $internArrayToIterateOffset
*/
public function setInternArrayToIterateOffset($_internArrayToIterateOffset)
{
$this->internArrayToIterateOffset = $_internArrayToIterateOffset;
}
/**
* @return bool
*/
public function getInternArrayToIterateIsArray()
{
return $this->internArrayToIterateIsArray;
}
/**
* @param bool $internArrayToIterateIsArray
*/
public function setInternArrayToIterateIsArray($_internArrayToIterateIsArray = false)
{
return ($this->internArrayToIterateIsArray = $_internArrayToIterateIsArray);
}
/**
* Generic method to set value
* @param string property name to set
* @param mixed property value to use
* @return bool
*/
public function _set($_name,$_value)
{
$setMethod = 'set' . ucfirst($_name);
if(method_exists($this,$setMethod))
{
$this->$setMethod($_value);
return true;
}
else
return false;
}
/**
* Generic method to get value
* @param string property name to get
* @return mixed
*/
public function _get($_name)
{
$getMethod = 'get' . ucfirst($_name);
if(method_exists($this,$getMethod))
return $this->$getMethod();
else
return false;
}
/**
* Method which returns alone attribute name when class is ArrayOf type
* @return string
*/
public function getAttributeName()
{
return '';
}
/**
* Méthode retournant le nom de la classe telle quelle
*
* @return string __CLASS__
*/
public function __toString()
{
return __CLASS__;
}
}
?>
Something went wrong with that request. Please try again.