Best Atoum code snippet using in.getParameters
mediamanagementcall.php
Source:mediamanagementcall.php
...55 private function handleCover(string $method,string $url="",string $assetLanguage="",string $description="",float $fromTime=0):void{56 if(substr($url,0,4)=="http"){57 $this->verb=defaults::VERB_POST;58 $this->method=$method;59 $this->getParameters()->set("url",$url);60 if(!empty($description)){61 $this->getParameters()->set("description",$description);62 }63 if(!empty($assetLanguage)){64 $this->getParameters()->set("assetLanguage",$assetLanguage);65 }66 }else if(($fromTime>0)&&(in_array($this->streamtype,[streamtypes::VIDEO,streamtypes::SCENE,'variant']))){67 $this->verb=defaults::VERB_POST;68 $this->method=$method;69 $this->getParameters()->set("fromTime",$fromTime);70 if(!empty($description)){71 $this->getParameters()->set("description",$description);72 }73 if(!empty($assetLanguage)){74 $this->getParameters()->set("assetLanguage",$assetLanguage);75 }76 }else{77 throw new \Exception("a valid Cover URL or TimeStamp (on Video Streamtypes only).");78 }79 }80 /**81 * @throws \Exception on invalid Parameters82 */83 public function createFromURL(string $url, bool $useQueue=TRUE,?bool $autoPublish=NULL, string $refnr="",int $queueStart=0, string $asVariantFor="", int $asVariantOf=0, string $sourceLanguage=""):void{84 if(in_array($this->streamtype,streamtypes::getUploadableTypes())){85 if(substr($url,0,4)=="http"){86 $this->verb=defaults::VERB_POST;87 $this->method="fromurl";88 $this->getParameters()->set("url",$url);89 if(!empty($refnr)){90 $this->getParameters()->set("refnr",$refnr);91 }92 if($useQueue){93 $this->getParameters()->set("useQueue",1);94 if($queueStart>0){95 $this->getParameters()->set("queueStart",$queueStart);96 }97 }98 if($autoPublish!==NULL){99 $this->getParameters()->set('autoPublish',($autoPublish?1:0));100 }101 if(($this->streamtype==streamtypes::VIDEO)||($this->streamtype==streamtypes::AUDIO)){102 if(strlen($sourceLanguage)==2){103 $this->getParameters()->set("language",$sourceLanguage);104 }105 }106 if($this->streamtype==streamtypes::VIDEO){107 if($asVariantOf>0){108 $this->getParameters()->set("asVariantOf",$asVariantOf);109 }110 if(!empty($asVariantFor)){111 if(in_array($asVariantFor,externalplatforms::getAllTypes())){112 $this->getParameters()->set("asVariantFor",$asVariantFor);113 }114 }115 }116 }else{117 throw new \Exception("URL must start with HTTP");118 }119 }else{120 throw new \Exception("Streamtype must be in ".implode(", ",streamtypes::getUploadableTypes()));121 }122 }123 /**124 * @throws \Exception on invalid Parameters125 */126 public function createFromData(string $title,string $refnr="",string $codename="",?bool $autoPublish=NULL,string $personGender="",string $personType=""):void{127 if(!in_array($this->streamtype,streamtypes::getUploadableTypes())){128 if(!empty($title)){129 $this->verb=defaults::VERB_POST;130 $this->method="fromdata";131 if(in_array($this->streamtype,[streamtypes::PERSON,streamtypes::GROUP])){132 $this->getParameters()->set('artistname',$title);133 if(!empty($personGender)){134 if(in_array($personGender,['m','f','n'])){135 $this->getParameters()->set('gender',$personGender);136 }else{137 throw new \Exception("valid Genders are m, f and n.");138 }139 }140 if(!empty($personType)){141 $this->getParameters()->set('type',$personType);142 }143 }else{144 $this->getParameters()->set('title',$title);145 }146 if(!empty($refnr)){147 $this->getParameters()->set("refnr",$refnr);148 }149 if(!empty($codename)){150 $this->getParameters()->set("codename",$refnr);151 }152 if($autoPublish!==NULL){153 $this->getParameters()->set("autoPublish",($autoPublish?1:0));154 }155 }else{156 throw new \Exception("Title is mandatory");157 }158 }else{159 throw new \Exception("Streamtype cannot be in ".implode(", ",streamtypes::getUploadableTypes()));160 }161 }162 /**163 * @throws \Exception on invalid Parameters164 */165 public function createFromTopic(string $title, string $topic="", string $itemSource="",int $duration=0,int $itemCount=0, string $searchMode="", array $searchFields=[], int $channel=0, int $format=0, int $category=0):void{166 if(in_array($this->streamtype,streamtypes::getSimpleContainerTypes())){167 $this->verb=defaults::VERB_POST;168 $this->method="fromtopic";169 if(!empty($title)){170 $this->getParameters()->set("title",$title);171 }else{172 throw new \Exception("title cant be empty");173 }174 $isSearch=FALSE;175 if(!empty($topic)){176 $isSearch=TRUE;177 if(!empty($searchFields)){178 $this->getParameters()->set("searchFields",implode(",",$searchFields));179 }180 if((!empty($searchMode))&&(in_array($searchMode,querymodes::getAllTypes()))){181 $this->getParameters()->set("searchMode",$searchMode);182 }183 }184 if(in_array($this->streamtype,[streamtypes::ALBUM,streamtypes::MAGAZINE])){185 if(empty($itemCount)){186 throw new \Exception("this streamtype requires a valid itemCount.");187 }else{188 $this->getParameters()->set("items",$itemCount);189 }190 }else{191 if(empty($duration)){192 throw new \Exception("this streamtype requires a valid target Duration.");193 }else{194 $this->getParameters()->set("duration",$duration);195 }196 }197 if((!$isSearch)&&(empty($itemSource))){198 throw new \Exception("if no topic is given, an itemSource is necessary.");199 }else if(in_array($itemSource,topicitemsources::getAllTypes())){200 $this->getParameters()->set("itemSource",$itemSource);201 }else{202 throw new \Exception("if no topic is given, a valid itemSource is necessary.");203 }204 if(!empty($channel)){205 $this->getParameters()->set("channel",$channel);206 }207 if(!empty($format)){208 $this->getParameters()->set("format",$format);209 }210 if(!empty($category)){211 $this->getParameters()->set("category",$category);212 }213 }else{214 throw new \Exception("Streamtype must be in ".implode(", ",streamtypes::getSimpleContainerTypes()));215 }216 }217 /**218 * @throws \Exception on invalid Parameters219 */220 public function createHighlightVideoFromVideo(int $videoID,int $duration,bool $includeAudio=TRUE,string $purpose=""):void{221 if($videoID>0){222 $this->setStreamtype(streamtypes::VIDEO);223 $this->verb=defaults::VERB_POST;224 $this->method="fromvideo/".$videoID;225 if(!empty($duration)){226 $this->getParameters()->set("duration",$duration);227 }else{228 throw new \Exception("a Duration must be given.");229 }230 if($includeAudio){231 $this->getParameters()->set("includeAudio",1);232 }233 if(in_array($purpose,highlightvideopurposes::getAllTypes())){234 $this->getParameters()->set("purpose",$purpose);235 }236 }else{237 throw new \Exception("the Video ID must be given.");238 }239 }240 /**241 * @throws \Exception on invalid Parameters242 */243 public function createLiveStreamFromLiveConnection(int $liveConnectionID=0,string $title="",string $type=livestreamtypes::EVENT):void{244 if($liveConnectionID>0){245 $this->setStreamtype(streamtypes::LIVE);246 $this->verb=defaults::VERB_POST;247 $this->method="fromliveconnection/".$liveConnectionID;248 if(!empty($title)){249 $this->getParameters()->set("title",$title);250 }251 if(in_array($type,livestreamtypes::getAllTypes())){252 $this->getParameters()->set("type",$type);253 }254 }else{255 throw new \Exception("the LiveConnection ID must be given.");256 }257 }258 public function createLiveStreamFromAutoLiveConnection(string $title="",string $type=livestreamtypes::EVENT,string $sourceType=livesourcetypes::RTMP,bool $enableDVR=FALSE):void{259 $this->setStreamtype(streamtypes::LIVE);260 $this->verb=defaults::VERB_POST;261 $this->method="fromautoliveconnection";262 if(!empty($title)){263 $this->getParameters()->set("title",$title);264 }265 if(!empty($sourceType)){266 if(in_array($type,livesourcetypes::getAllTypes())){267 $this->getParameters()->set("sourceType",$type);268 }269 }270 if($enableDVR){271 $this->getParameters()->set("enableDVR",1);272 }273 if(in_array($type,livestreamtypes::getAllTypes())){274 $this->getParameters()->set("type",$type);275 }276 }277 /**278 * @throws \Exception on invalid Parameters279 */280 public function createLiveStreamFromRemote(string $hlsURL,string $dashURL="",string $title="",string $type=livestreamtypes::EVENT):void{281 if((!empty($hlsURL))&&(substr($hlsURL,0,4)=="http")){282 $this->setStreamtype(streamtypes::LIVE);283 $this->verb=defaults::VERB_POST;284 $this->method="fromremote";285 $this->getParameters()->set("hlsURL",$hlsURL);286 if((!empty($dashURL))&&(substr($dashURL,0,4)=="http")){287 $this->getParameters()->set("dashURL",$dashURL);288 }289 if(!empty($title)){290 $this->getParameters()->set("title",$title);291 }292 if(in_array($type,livestreamtypes::getAllTypes())){293 $this->getParameters()->set("type",$type);294 }295 }else{296 throw new \Exception("a valid HLS URL must be given.");297 }298 }299 /**300 * @throws \Exception on invalid Parameters301 */302 public function createRadioFromLiveConnection(int $liveConnectionID=0,string $title="",string $type=livestreamtypes::EVENT):void{303 if($liveConnectionID>0){304 $this->setStreamtype(streamtypes::RADIO);305 $this->verb=defaults::VERB_POST;306 $this->method="fromliveconnection/".$liveConnectionID;307 if(!empty($title)){308 $this->getParameters()->set("title",$title);309 }310 if(in_array($type,livestreamtypes::getAllTypes())){311 $this->getParameters()->set("type",$type);312 }313 }else{314 throw new \Exception("the LiveConnection ID must be given.");315 }316 }317 public function createRadioFromAutoLiveConnection(string $title="",string $type=livestreamtypes::EVENT):void{318 $this->setStreamtype(streamtypes::RADIO);319 $this->verb=defaults::VERB_POST;320 $this->method="fromautoliveconnection";321 if(!empty($title)){322 $this->getParameters()->set("title",$title);323 }324 if(in_array($type,livestreamtypes::getAllTypes())){325 $this->getParameters()->set("type",$type);326 }327 }328 /**329 * @throws \Exception on invalid Parameters330 */331 public function createRadioFromRemote(string $url,string $title="",string $type=livestreamtypes::EVENT):void{332 if((!empty($url))&&(substr($url,0,4)=="http")){333 $this->setStreamtype(streamtypes::RADIO);334 $this->verb=defaults::VERB_POST;335 $this->method="fromremote";336 $this->getParameters()->set("url",$url);337 if(!empty($title)){338 $this->getParameters()->set("title",$title);339 }340 if(in_array($type,livestreamtypes::getAllTypes())){341 $this->getParameters()->set("type",$type);342 }343 }else{344 throw new \Exception("a valid URL must be given.");345 }346 }347 /**348 * @throws \Exception on invalid Parameters349 */350 public function createSceneFromVideo(int $videoID=0,string $title="",float $from=0,float $until=0,string $purpose=scenepurposes::CHAPTER):void{351 if($videoID>0){352 $this->setStreamtype(streamtypes::SCENE);353 $this->verb=defaults::VERB_POST;354 $this->method="fromvideo/".$videoID;355 $this->getParameters()->set("from",$from);356 if(!empty($until)){357 $this->getParameters()->set("until",$until);358 }else{359 throw new \Exception("a valid end time for the Scene must be given");360 }361 if(!empty($title)){362 $this->getParameters()->set("title",$title);363 }364 if(in_array($purpose,scenepurposes::getAllTypes())){365 $this->getParameters()->set("purpose",$purpose);366 }367 }else{368 throw new \Exception("the Video ID must be given.");369 }370 }371 /**372 * @throws \Exception on invalid Parameters373 */374 public function createAudioFromVideo(int $videoID=0):void{375 if($videoID>0){376 $this->setStreamtype(streamtypes::AUDIO);377 $this->verb=defaults::VERB_POST;378 $this->method="fromvideo/".$videoID;379 }else{380 throw new \Exception("the Video ID must be given.");381 }382 }383 /**384 * @throws \Exception on invalid Parameters385 */386 public function createAudioFromCaption(int $captionID=0):void{387 if($captionID>0){388 $this->setStreamtype(streamtypes::AUDIO);389 $this->verb=defaults::VERB_POST;390 $this->method="fromcaption/".$captionID;391 }else{392 throw new \Exception("the Caption ID must be given.");393 }394 }395 /**396 * @throws \Exception on invalid Parameters397 */398 public function createAudioFromText(string $textcontent, string $title="", string $subtitle="", string $teaser="",string $language="",string $voice=""):void{399 if(!empty($textcontent)){400 $this->setStreamtype(streamtypes::AUDIO);401 $this->verb=defaults::VERB_POST;402 $this->method="fromtext";403 $this->getParameters()->set("textcontent",$textcontent);404 if(strlen($language)==2){405 $this->getParameters()->set("language",$language);406 }407 if(!empty($title)){408 $this->getParameters()->set("title",$title);409 }410 if(!empty($subtitle)){411 $this->getParameters()->set("subtitle",$subtitle);412 }413 if(!empty($teaser)){414 $this->getParameters()->set("teaser",$teaser);415 }416 if(!empty($voice)){417 $this->getParameters()->set("voice",$voice);418 }419 }else{420 throw new \Exception("a non-empty Textcontent must be given.");421 }422 }423 /**424 * @throws \Exception on invalid Parameters425 */426 public function createImageFromVideo(int $videoID=0,float $from=0,float $until=0,string $title="",bool $useAsCover=FALSE):void{427 if($videoID>0){428 $this->setStreamtype(streamtypes::IMAGE);429 $this->verb=defaults::VERB_POST;430 $this->method="fromvideo/".$videoID;431 if(!empty($from)){432 $this->getParameters()->set("from",$from);433 }434 if(!empty($until)){435 $this->getParameters()->set("until",$until);436 }437 if(!empty($title)){438 $this->getParameters()->set("title",$title);439 }440 if($useAsCover){441 $this->getParameters()->set("useAsCover",1);442 }443 }else{444 throw new \Exception("the Video ID must be given.");445 }446 }447 /**448 * @throws \Exception on invalid Parameters449 */450 public function createPostFromText(int $accountID=0,string $postText="",int $postImage=0):void{451 if($accountID>0){452 $this->setStreamtype(streamtypes::POST);453 $this->verb=defaults::VERB_POST;454 $this->method="fromtext";455 $this->getParameters()->set("account",$accountID);456 if(!empty($postText)){457 $this->getParameters()->set("postText",$postText);458 }else{459 throw new \Exception("the Posting Text cant be empty.");460 }461 if($postImage>0){462 $this->getParameters()->set("postImage",$postImage);463 }464 }else{465 throw new \Exception("the Account ID must be given.");466 }467 }468 /**469 * @throws \Exception on invalid Parameters470 */471 public function updateItemFile(string $url):void{472 if(in_array($this->streamtype,streamtypes::getUploadableTypes())){473 if(substr($url,0,4)=="http"){474 $this->verb=defaults::VERB_PUT;475 $this->method="updatefile";476 $this->getParameters()->set("url",$url);477 }else{478 throw new \Exception("URL must start with HTTP");479 }480 }else{481 throw new \Exception("Streamtype must be in ".implode(", ",streamtypes::getUploadableTypes()));482 }483 }484 public function updateItemMetaData(array $attributes=[]):void{485 $this->verb=defaults::VERB_PUT;486 $this->method="update";487 foreach($attributes as $key=>$value){488 if(is_null($value)){489 $value="";490 }else if(is_array($value)){491 $value="";492 }493 $this->getParameters()->set($key,$value);494 }495 }496 public function updateItemRestrictions(array $restrictions=[]):void{497 $this->verb=defaults::VERB_PUT;498 $this->method="updaterestrictions";499 foreach($restrictions as $key=>$value){500 if(is_null($value)){501 $value="";502 }else if(is_array($value)){503 $value="";504 }505 $this->getParameters()->set($key,$value);506 }507 }508 public function updateAudioContent(string $textcontent="", string $title="", string $subtitle="", string $teaser="",string $language="",string $voice=""):void{509 $this->setStreamtype(streamtypes::AUDIO);510 $this->verb=defaults::VERB_PUT;511 $this->method="updatecontent";512 $this->getParameters()->set("textcontent",$textcontent);513 if(!empty($title)){514 $this->getParameters()->set("title",$title);515 }516 if(!empty($subtitle)){517 $this->getParameters()->set("subtitle",$subtitle);518 }519 if(!empty($teaser)){520 $this->getParameters()->set("teaser",$teaser);521 }522 if(!empty($textcontent)){523 $this->getParameters()->set("textcontent",$textcontent);524 }525 if(!empty($language)){526 $this->getParameters()->set("language",$language);527 }528 if(!empty($voice)){529 $this->getParameters()->set("voice",$voice);530 }531 }532 public function updateAudioRepresentation(bool $includeTitle=FALSE,bool $includeSubtitle=FALSE,bool $includeTeaser=FALSE,bool $includeFragments=FALSE):void{533 $this->setStreamtype(streamtypes::ARTICLE);534 $this->verb=defaults::VERB_PUT;535 $this->method="updateaudiorepresentation";536 if($includeTitle){537 $this->getParameters()->set("includeTitle",1);538 }539 if($includeSubtitle){540 $this->getParameters()->set("includeSubtitle",1);541 }542 if($includeTeaser){543 $this->getParameters()->set("includeTeaser",1);544 }545 if($includeFragments){546 $this->getParameters()->set("includeFragments",1);547 }548 }549 public function approveItem(string $reason,int $restrictToAge=0,array $contentModerationAspects=[]):void{550 $this->verb=defaults::VERB_POST;551 $this->method="approve";552 if(!empty($reason)){553 $this->getParameters()->set("reason",$reason);554 }555 if(in_array($restrictToAge,ageclasses::getAllTypes())){556 $this->getParameters()->set("restrictToAge",$restrictToAge);557 }558 if(!empty($contentModerationAspects)){559 $cm=[];560 foreach($contentModerationAspects as $cma){561 if(in_array($cma,contentmoderationaspects::getAllTypes())){562 array_push($cm,$cma);563 }564 }565 if(!empty($cm)){566 $this->getParameters()->set("contentModerationAspects",implode(",",$cm));567 }568 }569 }570 public function rejectItem(string $reason="",string $action=""):void{571 $this->verb=defaults::VERB_POST;572 $this->method="reject";573 if(!empty($reason)){574 $this->getParameters()->set("reason",$reason);575 }576 if(!empty($action)){577 if(in_array($action,rejectactions::getAllTypes())){578 $this->getParameters()->set("action",$action);579 }580 }581 }582 public function publishItem():void{583 $this->verb=defaults::VERB_PUT;584 $this->method="publish";585 }586 public function unpublishItem(?bool $blockFuturePublishing=NULL):void{587 $this->verb=defaults::VERB_PUT;588 $this->method="unpublish";589 if($blockFuturePublishing!==NULL){590 $this->getParameters()->set("blockFuturePublishing",($blockFuturePublishing?1:0));591 }592 }593 public function unblockItem():void{594 $this->verb=defaults::VERB_PUT;595 $this->method="unblock";596 }597 public function pickItem(int $index=1):void{598 $this->verb=defaults::VERB_PUT;599 $this->method="pick";600 $this->getParameters()->set("index",$index);601 }602 public function unpickItem():void{603 $this->verb=defaults::VERB_PUT;604 $this->method="unpick";605 }606 public function setItemAsNew():void{607 $this->verb=defaults::VERB_PUT;608 $this->method="setasnew";609 }610 public function removeItem():void{611 $this->verb=defaults::VERB_DELETE;612 $this->method="remove";613 }614 /**615 * @throws \Exception on invalid Parameters616 */617 public function transferItemToDomain(int $targetDomain=0,bool $andDeleteOriginal=FALSE):void{618 if($targetDomain>0){619 $this->verb=defaults::VERB_POST;620 $this->method="transfertodomain/".$targetDomain;621 if($andDeleteOriginal){622 $this->getParameters()->set("andDeleteOriginal",1);623 }624 }else{625 throw new \Exception("A target Domain must be given");626 }627 }628 /**629 * @throws \Exception on invalid Parameters630 */631 public function reorderItem(?array $itemlist=[],string $autoOrder="",string $autoOrderDirection=""):void{632 if(in_array($this->streamtype,streamtypes::getContainerTypes())){633 $this->verb=defaults::VERB_PUT;634 $this->method="reorder";635 if(!empty($itemlist)){636 $this->getParameters()->set("itemlist",implode(",",$itemlist));637 }else if((!empty($autoOrder))&&(in_array($autoOrder,autoorderattributes::getAllTypes()))){638 $this->getParameters()->set("autoorder",$autoOrder);639 if(in_array($autoOrderDirection,["ASC","DESC"])){640 $this->getParameters()->set("autoorderdirection",$autoOrderDirection);641 }642 }else{643 throw new \Exception("an itemlist or a valid autoOrder String must be given");644 }645 }else{646 throw new \Exception("only Container Elements can be reordered.");647 }648 }649 /**650 * @throws \Exception on invalid Parameters651 */652 public function reencodeItem(string $reason=""):void{653 if(in_array($this->streamtype,[streamtypes::VIDEO,streamtypes::AUDIO])){654 $this->verb=defaults::VERB_POST;655 $this->method="reencode";656 if(!empty($reason)){657 $this->getParameters()->set("reason",$reason);658 }659 }else{660 throw new \Exception("Streamtype must be in video, audio");661 }662 }663 /**664 * @throws \Exception on invalid Parameters665 */666 public function analyzeItemDetails():void{667 if(in_array($this->streamtype,[streamtypes::VIDEO,streamtypes::AUDIO])){668 $this->verb=defaults::VERB_POST;669 $this->method="analyzedetails";670 }else{671 throw new \Exception("Streamtype must be in video, audio");672 }673 }674 /**675 * @throws \Exception on invalid Parameters676 */677 public function archiveItem():void{678 if(in_array($this->streamtype,[streamtypes::VIDEO])){679 $this->verb=defaults::VERB_POST;680 $this->method="archive";681 }else{682 throw new \Exception("Streamtype must be video");683 }684 }685 /**686 * @throws \Exception on invalid Parameters687 */688 public function terminateStream():void{689 if(in_array($this->streamtype,[streamtypes::LIVE])){690 $this->verb=defaults::VERB_POST;691 $this->method="terminate";692 }else{693 throw new \Exception("Streamtype must be live");694 }695 }696 /**697 * @throws \Exception on invalid Parameters698 */699 public function updatePlaybackState(string $state):void{700 if(in_array($this->streamtype,[streamtypes::LIVE])){701 if(in_array($state,liveplaybackstates::getAllTypes())){702 $this->verb=defaults::VERB_POST;703 $this->method="updateplaybackstate";704 $this->getParameters()->set('state',$state);705 }else{706 throw new \Exception("Live PlaybackState must be in on,pause");707 }708 }else{709 throw new \Exception("Streamtype must be live");710 }711 }712 /**713 * @throws \Exception on invalid Parameters714 */715 public function startRecording():void{716 if(in_array($this->streamtype,[streamtypes::LIVE])){717 $this->verb=defaults::VERB_POST;718 $this->method="startrecording";719 }else{720 throw new \Exception("Streamtype must be live");721 }722 }723 /**724 * @throws \Exception on invalid Parameters725 */726 public function stopRecording():void{727 if(in_array($this->streamtype,[streamtypes::LIVE])){728 $this->verb=defaults::VERB_POST;729 $this->method="stoprecording";730 }else{731 throw new \Exception("Streamtype must be live");732 }733 }734 /**735 * @throws \Exception on invalid Parameters736 */737 public function exportItem(int $accountID,string $externalCategory="",string $externalState=externalstates::PUBLIC, string $postText="",int $publicationDate=0,int $inVariant=0,int $list=0):void{738 if($accountID>0){739 if(in_array($this->streamtype,streamtypes::getExportableTypes())){740 $this->verb=defaults::VERB_POST;741 $this->method="export";742 $this->getParameters()->set("account",$accountID);743 if(!empty($list)){744 $this->getParameters()->set("list",$list);745 }746 if(!empty($externalCategory)){747 $this->getParameters()->set("externalCategory",$externalCategory);748 }749 if(in_array($externalState,externalstates::getAllTypes())){750 $this->getParameters()->set("externalState",$externalState);751 }752 if(($publicationDate>0)&&($externalState==externalstates::PRIVATE)){753 $this->getParameters()->set("publicationDate",$publicationDate);754 }755 if(($this->streamtype==streamtypes::VIDEO)&&(!empty($inVariant))){756 $this->getParameters()->set("inVariant",$inVariant);757 }else if(($this->streamtype==streamtypes::ARTICLE)&&(!empty($postText))){758 $this->getParameters()->set("postText",$postText);759 }760 }else{761 throw new \Exception("this streamtype is not supported.");762 }763 }else{764 throw new \Exception("the ID of the Account must be given.");765 }766 }767 /**768 * @throws \Exception on invalid Parameters769 */770 public function exportItemAsPost(int $accountID,string $postURL="",string $postText="",string $postImage="",bool $postWithLink=FALSE):void{771 if($accountID>0){772 if(in_array($this->streamtype,streamtypes::getExportableTypes())){773 $this->verb=defaults::VERB_POST;774 $this->method="exportaspost";775 $this->getParameters()->set("account",$accountID);776 if(!empty($postURL)){777 $this->getParameters()->set("postURL",$postURL);778 }779 if(!empty($postText)){780 $this->getParameters()->set("postText",$postText);781 }782 if(!empty($postImage)){783 $this->getParameters()->set("postImage",$postImage);784 }785 if(($this->streamtype==streamtypes::ARTICLE)&&($postWithLink)){786 $this->getParameters()->set("postWithLink",1);787 }788 }else{789 throw new \Exception("this streamtype is not supported.");790 }791 }else{792 throw new \Exception("the ID of the Account must be given.");793 }794 }795 /**796 * @throws \Exception on invalid Parameters797 */798 public function updateItemExport(string $externalReference="",int $exportID=0,string $partToUpdate=""):void{799 $this->verb=defaults::VERB_PUT;800 $this->method="updateexport";801 if(in_array($partToUpdate,exportparts::getAllTypes())){802 $this->getParameters()->set("partToUpdate",$partToUpdate);803 }else{804 throw new \Exception("the partToUpdate Parameter must be one of ".implode(",",exportparts::getAllTypes()));805 }806 if(!empty($externalReference)){807 $this->getParameters()->set("externalReference",$externalReference);808 }else if(!empty($exportID)){809 $this->getParameters()->set("item",$exportID);810 }else{811 throw new \Exception("the target Export must be given by internal or external Reference");812 }813 }814 /**815 * @throws \Exception on invalid Parameters816 */817 public function deleteItemExport(string $externalReference="",int $exportID=0):void{818 $this->verb=defaults::VERB_DELETE;819 $this->method="removeexport";820 if(!empty($externalReference)){821 $this->getParameters()->set("externalReference",$externalReference);822 }else if(!empty($exportID)){823 $this->getParameters()->set("item",$exportID);824 }else{825 throw new \Exception("the target Export must be given by internal or external Reference");826 }827 }828 /**829 * @throws \Exception on invalid Parameters830 */831 public function addItemPreviewLink(string $language="",int $maxStarts=0,string $code="",bool $showAnnotations=TRUE,bool $allowAnnotations=TRUE,bool $allowSnapshots=FALSE,bool $allowSourceDownloads=FALSE,bool $useDomainStyle=FALSE):void{832 if(in_array($this->streamtype,streamtypes::getPlayerTypes())){833 $this->verb=defaults::VERB_POST;834 $this->method="addpreviewlink";835 if((!empty($language))&&(strlen($language)==2)){836 $this->getParameters()->set("language",$language);837 }838 if($maxStarts>0){839 $this->getParameters()->set("maxStarts",$maxStarts);840 }841 if(!empty($code)){842 $this->getParameters()->set("code",$code);843 }844 if($showAnnotations){845 $this->getParameters()->set("showAnnotations",1);846 }847 if($allowAnnotations){848 $this->getParameters()->set("allowAnnotations",1);849 }850 if($allowSnapshots){851 $this->getParameters()->set("allowSnapshots",1);852 }853 if($allowSourceDownloads){854 $this->getParameters()->set("allowSourceDownloads",1);855 }856 if($useDomainStyle){857 $this->getParameters()->set("useDomainStyle",1);858 }859 }else{860 throw new \Exception("Streamtype must be in ".implode(", ",streamtypes::getPlayerTypes()));861 }862 }863 /**864 * @throws \Exception on invalid Parameters865 */866 public function deleteItemPreviewLink(int $previewlinkID=0):void{867 if($previewlinkID>0){868 $this->verb=defaults::VERB_DELETE;869 $this->method="removepreviewlink/".$previewlinkID;870 }else{871 throw new \Exception("the ID of the PreviewLink must be given.");872 }873 }874 /**875 * @throws \Exception on invalid Parameters876 */877 public function addItemToContainer(int $containerID=0):void{878 if($containerID>0){879 $this->verb=defaults::VERB_POST;880 $this->method="addtocontainer/".$containerID;881 }else{882 throw new \Exception("the ID of the Container must be given.");883 }884 }885 /**886 * @throws \Exception on invalid Parameters887 */888 public function addItemToCollection(int $collectionID=0):void{889 if($collectionID>0){890 $this->verb=defaults::VERB_POST;891 $this->method="addtocollection/".$collectionID;892 }else{893 throw new \Exception("the ID of the Collection must be given.");894 }895 }896 /**897 * @throws \Exception on invalid Parameters898 */899 public function addItemToSet(int $setID=0, string $purpose=''):void{900 if($setID>0){901 $this->verb=defaults::VERB_POST;902 $this->method="addtoset/".$setID;903 if(!empty($purpose)){904 $this->getParameters()->set("purpose",$purpose);905 }906 }else{907 throw new \Exception("the ID of the Set must be given.");908 }909 }910 /**911 * @throws \Exception on invalid Parameters912 */913 public function addItemToRack(int $rackID=0, string $purpose=''):void{914 if($rackID>0){915 $this->verb=defaults::VERB_POST;916 $this->method="addtorack/".$rackID;917 if(!empty($purpose)){918 $this->getParameters()->set("purpose",$purpose);919 }920 }else{921 throw new \Exception("the ID of the Rack must be given.");922 }923 }924 /**925 * @throws \Exception on invalid Parameters926 */927 public function addItemToBundle(int $bundleID=0):void{928 if($bundleID>0){929 $this->verb=defaults::VERB_POST;930 $this->method="addtobundle/".$bundleID;931 }else{932 throw new \Exception("the ID of the Bundle must be given.");933 }934 }935 /**936 * @throws \Exception on invalid Parameters937 */938 public function removeItemFromContainer(int $containerID=0):void{939 if($containerID>0){940 $this->verb=defaults::VERB_DELETE;941 $this->method="removefromcontainer/".$containerID;942 }else{943 throw new \Exception("the ID of the Container must be given.");944 }945 }946 /**947 * @throws \Exception on invalid Parameters948 */949 public function removeItemFromCollection(int $collectionID=0):void{950 if($collectionID>0){951 $this->verb=defaults::VERB_DELETE;952 $this->method="removefromcollection/".$collectionID;953 }else{954 throw new \Exception("the ID of the Collection must be given.");955 }956 }957 /**958 * @throws \Exception on invalid Parameters959 */960 public function removeItemFromSet(int $setID=0):void{961 if($setID>0){962 $this->verb=defaults::VERB_DELETE;963 $this->method="removefromset/".$setID;964 }else{965 throw new \Exception("the ID of the Set must be given.");966 }967 }968 /**969 * @throws \Exception on invalid Parameters970 */971 public function removeItemFromRack(int $rackID=0):void{972 if($rackID>0){973 $this->verb=defaults::VERB_DELETE;974 $this->method="removefromrack/".$rackID;975 }else{976 throw new \Exception("the ID of the Rack must be given.");977 }978 }979 /**980 * @throws \Exception on invalid Parameters981 */982 public function removeItemFromBundle(int $bundleID=0):void{983 if($bundleID>0){984 $this->verb=defaults::VERB_DELETE;985 $this->method="removefrombundle/".$bundleID;986 }else{987 throw new \Exception("the ID of the Bundle must be given.");988 }989 }990 /**991 * @throws \Exception on invalid Parameters992 */993 public function connectLinkToItem(int $linkID=0):void{994 if($linkID>0){995 $this->verb=defaults::VERB_PUT;996 $this->method="connectlink/".$linkID;997 }else{998 throw new \Exception("the ID of the Link must be given.");999 }1000 }1001 /**1002 * @throws \Exception on invalid Parameters1003 */1004 public function connectFileToItem(int $fileID=0):void{1005 if($fileID>0){1006 $this->verb=defaults::VERB_PUT;1007 $this->method="connectfile/".$fileID;1008 }else{1009 throw new \Exception("the ID of the File must be given.");1010 }1011 }1012 /**1013 * @throws \Exception on invalid Parameters1014 */1015 public function connectPersonToItem(int $personID=0, string $purpose=''):void{1016 if($personID>0){1017 $this->verb=defaults::VERB_PUT;1018 $this->method="connectperson/".$personID;1019 if(!empty($purpose)){1020 $this->getParameters()->set("purpose",$purpose);1021 }1022 }else{1023 throw new \Exception("the ID of the Person must be given.");1024 }1025 }1026 /**1027 * @throws \Exception on invalid Parameters1028 */1029 public function connectGroupToItem(int $groupID=0, string $purpose=''):void{1030 if($groupID>0){1031 $this->verb=defaults::VERB_PUT;1032 $this->method="connectgroup/".$groupID;1033 if(!empty($purpose)){1034 $this->getParameters()->set("purpose",$purpose);1035 }1036 }else{1037 throw new \Exception("the ID of the Group must be given.");1038 }1039 }1040 /**1041 * @throws \Exception on invalid Parameters1042 */1043 public function connectShowToItem(int $showID=0):void{1044 if($showID>0){1045 $this->verb=defaults::VERB_PUT;1046 $this->method="connectshow/".$showID;1047 }else{1048 throw new \Exception("the ID of the Show must be given.");1049 }1050 }1051 /**1052 * @throws \Exception on invalid Parameters1053 */1054 public function connectPlaceToItem(int $placeID=0):void{1055 if($placeID>0){1056 $this->verb=defaults::VERB_PUT;1057 $this->method="connectplace/".$placeID;1058 }else{1059 throw new \Exception("the ID of the Place must be given.");1060 }1061 }1062 /**1063 * @throws \Exception on invalid Parameters1064 */1065 public function connectProductToItem(int $productID=0):void{1066 if($productID>0){1067 $this->verb=defaults::VERB_PUT;1068 $this->method="connectproduct/".$productID;1069 }else{1070 throw new \Exception("the ID of the Product must be given.");1071 }1072 }1073 /**1074 * @throws \Exception on invalid Parameters1075 */1076 public function removeLinkFromItem(int $linkID=0):void{1077 if($linkID>0){1078 $this->verb=defaults::VERB_DELETE;1079 $this->method="removelink/".$linkID;1080 }else{1081 throw new \Exception("the ID of the Link must be given.");1082 }1083 }1084 /**1085 * @throws \Exception on invalid Parameters1086 */1087 public function removeFileFromItem(int $fileID=0):void{1088 if($fileID>0){1089 $this->verb=defaults::VERB_DELETE;1090 $this->method="removefile/".$fileID;1091 }else{1092 throw new \Exception("the ID of the File must be given.");1093 }1094 }1095 /**1096 * @throws \Exception on invalid Parameters1097 */1098 public function removePersonFromItem(int $personID=0):void{1099 if($personID>0){1100 $this->verb=defaults::VERB_DELETE;1101 $this->method="removeperson/".$personID;1102 }else{1103 throw new \Exception("the ID of the Person must be given.");1104 }1105 }1106 /**1107 * @throws \Exception on invalid Parameters1108 */1109 public function removeGroupFromItem(int $groupID=0):void{1110 if($groupID>0){1111 $this->verb=defaults::VERB_DELETE;1112 $this->method="removegroup/".$groupID;1113 }else{1114 throw new \Exception("the ID of the Group must be given.");1115 }1116 }1117 /**1118 * @throws \Exception on invalid Parameters1119 */1120 public function removeShowFromItem(int $showID=0):void{1121 if($showID>0){1122 $this->verb=defaults::VERB_DELETE;1123 $this->method="removeshow/".$showID;1124 }else{1125 throw new \Exception("the ID of the Show must be given.");1126 }1127 }1128 /**1129 * @throws \Exception on invalid Parameters1130 */1131 public function removePlaceFromItem(int $placeID=0):void{1132 if($placeID>0){1133 $this->verb=defaults::VERB_DELETE;1134 $this->method="removeplace/".$placeID;1135 }else{1136 throw new \Exception("the ID of the Place must be given.");1137 }1138 }1139 /**1140 * @throws \Exception on invalid Parameters1141 */1142 public function removeProductFromItem(int $productID=0):void{1143 if($productID>0){1144 $this->verb=defaults::VERB_DELETE;1145 $this->method="removeproduct/".$productID;1146 }else{1147 throw new \Exception("the ID of the Product must be given.");1148 }1149 }1150 /**1151 * @throws \Exception on invalid Parameters1152 */1153 public function setItemCover(string $url="",string $assetLanguage="",string $description="",float $fromTime=0):void{1154 $this->handleCover("cover",$url,$assetLanguage,$description,$fromTime);1155 }1156 /**1157 * @throws \Exception on invalid Parameters1158 */1159 public function setItemCoverAlternative(string $url="",string $assetLanguage="",string $description="",float $fromTime=0):void{1160 $this->handleCover("alternativecover",$url,$assetLanguage,$description,$fromTime);1161 }1162 /**1163 * @throws \Exception on invalid Parameters1164 */1165 public function setItemCoverABTest(string $url="",string $assetLanguage="",string $description="",float $fromTime=0):void{1166 $this->handleCover("abtestalternative",$url,$assetLanguage,$description,$fromTime);1167 }1168 /**1169 * @throws \Exception on invalid Parameters1170 */1171 public function setItemCoverActionShot(string $url="",string $assetLanguage="",string $description="",float $fromTime=0):void{1172 $this->handleCover("actionshot",$url,$assetLanguage,$description,$fromTime);1173 }1174 /**1175 * @throws \Exception on invalid Parameters1176 */1177 public function setItemCoverQuad(string $url="",string $assetLanguage="",string $description="",float $fromTime=0):void{1178 $this->handleCover("quadcover",$url,$assetLanguage,$description,$fromTime);1179 }1180 /**1181 * @throws \Exception on invalid Parameters1182 */1183 public function setItemCoverBanner(string $url="",string $assetLanguage="",string $description="",float $fromTime=0):void{1184 $this->handleCover("banner",$url,$assetLanguage,$description,$fromTime);1185 }1186 /**1187 * @throws \Exception on invalid Parameters1188 */1189 public function setItemCoverFamilySafe(string $url="",string $assetLanguage="",string $description="",float $fromTime=0):void{1190 $this->handleCover("familysafe",$url,$assetLanguage,$description,$fromTime);1191 }1192 /**1193 * @throws \Exception on invalid Parameters1194 */1195 public function setItemCoverArtwork(string $url="",string $assetLanguage=""):void{1196 $this->handleCover("artwork",$url,$assetLanguage);1197 }1198 /**1199 * @throws \Exception on invalid Parameters1200 */1201 public function addCaptionsFromURL(string $url="",string $language="",string $title="",bool $withAudioDescription=FALSE):void{1202 if(in_array($this->streamtype,[streamtypes::VIDEO,streamtypes::AUDIO])){1203 if(substr($url,0,4)=="http"){1204 $this->verb=defaults::VERB_POST;1205 $this->method="captionsfromurl";1206 $this->getParameters()->set("url",$url);1207 if(strlen($language)==2){1208 $this->getParameters()->set("language",$language);1209 }else{1210 throw new \Exception("language must be given in 2-Letter-Code");1211 }1212 if(!empty($title)){1213 $this->getParameters()->set("title",$title);1214 }1215 if($withAudioDescription){1216 $this->getParameters()->set("withAudioDescription",1);1217 }1218 }else{1219 throw new \Exception("a valid Caption URL is missing.");1220 }1221 }else{1222 throw new \Exception("Streamtype must be in video,audio");1223 }1224 }1225 /**1226 * @throws \Exception on invalid Parameters1227 */1228 public function addCaptionsFromSpeech():void{1229 if(in_array($this->streamtype,[streamtypes::VIDEO,streamtypes::AUDIO])){1230 $this->verb=defaults::VERB_POST;1231 $this->method="captionsfromspeech";1232 }else{1233 throw new \Exception("Streamtype must be in video,audio");1234 }1235 }1236 /**1237 * @throws \Exception on invalid Parameters1238 */1239 public function translateCaptionsTo($targetLanguage=""):void{1240 if(in_array($this->streamtype,[streamtypes::VIDEO,streamtypes::AUDIO])){1241 if(strlen($targetLanguage)==2){1242 $this->verb=defaults::VERB_POST;1243 $this->method="translatecaptionsto/".$targetLanguage;1244 }else{1245 throw new \Exception("Target Language must be given in 2-Letter-Code");1246 }1247 }else{1248 throw new \Exception("Streamtype must be in video,audio");1249 }1250 }1251 /**1252 * @throws \Exception on invalid Parameters1253 */1254 public function removeCaptions(string $language="",bool $withAudioDescription=FALSE):void{1255 if(in_array($this->streamtype,[streamtypes::VIDEO,streamtypes::AUDIO])){1256 if(strlen($language)==2){1257 $this->verb=defaults::VERB_DELETE;1258 $this->method="removecaptions";1259 $this->getParameters()->set("language",$language);1260 if($withAudioDescription){1261 $this->getParameters()->set("withAudioDescription",1);1262 }1263 }else{1264 throw new \Exception("Language must be given in 2-Letter-Code");1265 }1266 }else{1267 throw new \Exception("Streamtype must be in video,audio");1268 }1269 }1270 /**1271 * @throws \Exception on invalid Parameters1272 */1273 public function translateMetadataTo(string $language):void{1274 if(strlen($language)==2){1275 $this->verb=defaults::VERB_POST;1276 $this->method="translateto/".$language;1277 }else{1278 throw new \Exception("Language must be given in 2-Letter-Code");1279 }1280 }1281 /**1282 * @throws \Exception on invalid Parameters1283 */1284 public function addTranslation(string $language,string $title="",string $subtitle="",string $teaser="",string $description="", string $orderhint=""):void{1285 if(strlen($language)==2){1286 $this->verb=defaults::VERB_POST;1287 $this->method="addtranslation";1288 $this->getParameters()->set("language",$language);1289 if(!empty($title)){1290 $this->getParameters()->set("title",$title);1291 }1292 if(!empty($subtitle)){1293 $this->getParameters()->set("subtitle",$subtitle);1294 }1295 if(!empty($teaser)){1296 $this->getParameters()->set("teaser",$teaser);1297 }1298 if(!empty($description)){1299 $this->getParameters()->set(($this->streamtype==streamtypes::ARTICLE?"textcontent":"description"),$description);1300 }1301 if(!empty($orderhint)){1302 $this->getParameters()->set("orderhint",$orderhint);1303 }1304 }else{1305 throw new \Exception("Language must be given in 2-Letter-Code");1306 }1307 }1308 /**1309 * @throws \Exception on invalid Parameters1310 */1311 public function updateTranslation(string $language,string $title="",string $subtitle="",string $teaser="",string $description="", string $orderhint=""):void{1312 if(strlen($language)==2){1313 $this->verb=defaults::VERB_PUT;1314 $this->method="updatetranslation";1315 $this->getParameters()->set("language",$language);1316 if(!empty($title)){1317 $this->getParameters()->set("title",$title);1318 }1319 if(!empty($subtitle)){1320 $this->getParameters()->set("subtitle",$subtitle);1321 }1322 if(!empty($teaser)){1323 $this->getParameters()->set("teaser",$teaser);1324 }1325 if(!empty($description)){1326 $this->getParameters()->set(($this->streamtype==streamtypes::ARTICLE?"textcontent":"description"),$description);1327 }1328 if(!empty($orderhint)){1329 $this->getParameters()->set("orderhint",$orderhint);1330 }1331 }else{1332 throw new \Exception("Language must be given in 2-Letter-Code");1333 }1334 }1335 /**1336 * @throws \Exception on invalid Parameters1337 */1338 public function removeTranslation(string $language):void{1339 if(strlen($language)==2){1340 $this->verb=defaults::VERB_DELETE;1341 $this->method="removetranslation";1342 $this->getParameters()->set("language",$language);1343 }else{1344 throw new \Exception("Language must be given in 2-Letter-Code");1345 }1346 }1347 /**1348 * @throws \Exception on invalid Parameters1349 */1350 public function addHotSpot(string $type,int $from,int $to, string $title,string $subtitle="",string $link="",string $detailTitle="",string $detailText="",bool $autoPosition=TRUE, int $xPos=0,int $yPos=0, int $maxWidth=0,int $linkedVideo=0,bool $showCover=TRUE,string $imageURL="",float $seekTarget=0):void{1351 if((!empty($type))&&(in_array($type,hotspottypes::getAllTypes()))){1352 $this->verb=defaults::VERB_POST;1353 $this->method="addhotspot";1354 $this->getParameters()->set("type",$type);1355 if(!empty($from)){1356 $this->getParameters()->set("from",$from);1357 }1358 if(!empty($to)){1359 $this->getParameters()->set("to",$to);1360 }1361 if(!empty($title)){1362 $this->getParameters()->set("title",$title);1363 }1364 if($autoPosition){1365 $this->getParameters()->set("autoPosition",1);1366 }else{1367 $this->getParameters()->set("autoPosition",0);1368 $this->getParameters()->set("xPos",$xPos);1369 $this->getParameters()->set("yPos",$yPos);1370 }1371 if($type==hotspottypes::LINK){1372 if(!empty($link)){1373 $this->getParameters()->set("link",$link);1374 }else{1375 throw new \Exception("A HotSpot of Type 'link' must have a link Target");1376 }1377 }1378 if($type==hotspottypes::VIDEO){1379 if(!empty($linkedVideo)){1380 $this->getParameters()->set("linkedVideo",$linkedVideo);1381 $this->getParameters()->set("showCover",($showCover?1:0));1382 }else{1383 throw new \Exception("A HotSpot of Type 'video' must have a linkedVideo");1384 }1385 }1386 if($type==hotspottypes::SEEK){1387 if(!empty($seekTarget)){1388 $this->getParameters()->set("seekTarget",$seekTarget);1389 }else{1390 throw new \Exception("A HotSpot of Type 'seek' must have a seekTarget");1391 }1392 }1393 if($type==hotspottypes::BANNER){1394 if(!empty($imageURL)){1395 $this->getParameters()->set("imageURL",$imageURL);1396 if(!empty($maxWidth)){1397 $this->getParameters()->set("maxWidth",$maxWidth);1398 }1399 if(!empty($link)){1400 $this->getParameters()->set("link",$link);1401 }1402 }else{1403 throw new \Exception("A HotSpot of Type 'banner' must give an imageURL");1404 }1405 }1406 if($type==hotspottypes::INTERSTITIAL){1407 if(!empty($detailTitle)){1408 $this->getParameters()->set("detailTitle",$detailTitle);1409 }1410 if(!empty($detailText)){1411 $this->getParameters()->set("detailText",$detailText);1412 }else{1413 throw new \Exception("A HotSpot of Type 'interstitial' must have a detailText");1414 }1415 }else if(!empty($subtitle)){1416 $this->getParameters()->set("subtitle",$subtitle);1417 }1418 }else{1419 throw new \Exception("Type must be in ",implode(", ",hotspottypes::getAllTypes()));1420 }1421 }1422 /**1423 * @throws \Exception on invalid Parameters1424 */1425 public function updateHotSpot(int $hotspotid,int $from=0,int $to=0, string $title="",string $subtitle="",string $link="",string $detailTitle="",string $detailText="",bool $autoPosition=TRUE, int $xPos=0,int $yPos=0, int $maxWidth=0,int $linkedVideo=0,bool $showCover=TRUE,string $imageURL="",float $seekTarget=0):void{1426 if(!empty($hotspotid)){1427 $this->verb=defaults::VERB_PUT;1428 $this->method="updatehotspot";1429 $this->getParameters()->set("hotspotid",$hotspotid);1430 if(!empty($from)){1431 $this->getParameters()->set("from",$from);1432 }1433 if(!empty($to)){1434 $this->getParameters()->set("to",$to);1435 }1436 if(!empty($title)){1437 $this->getParameters()->set("title",$title);1438 }1439 if(!empty($subtitle)){1440 $this->getParameters()->set("subtitle",$subtitle);1441 }1442 if(!empty($link)){1443 $this->getParameters()->set("link",$link);1444 }1445 if(!empty($detailTitle)){1446 $this->getParameters()->set("detailTitle",$detailTitle);1447 }1448 if(!empty($detailText)){1449 $this->getParameters()->set("detailText",$detailText);1450 }1451 if(!empty($xPos)){1452 $this->getParameters()->set("xPos",$xPos);1453 }1454 if(!empty($yPos)){1455 $this->getParameters()->set("yPos",$yPos);1456 }1457 if(!empty($maxWidth)){1458 $this->getParameters()->set("maxWidth",$maxWidth);1459 }1460 if(!empty($linkedVideo)){1461 $this->getParameters()->set("linkedVideo",$linkedVideo);1462 }1463 if(!empty($imageURL)){1464 $this->getParameters()->set("imageURL",$imageURL);1465 }1466 if(!empty($seekTarget)){1467 $this->getParameters()->set("seekTarget",$seekTarget);1468 }1469 $this->getParameters()->set("autoPosition",($autoPosition?1:0));1470 $this->getParameters()->set("showCover",($showCover?1:0));1471 }else{1472 throw new \Exception("HotSpot ID cant be empty");1473 }1474 }1475 /**1476 * @throws \Exception on invalid Parameters1477 */1478 public function removeHotSpot(int $hotspotid):void{1479 if(!empty($hotspotid)){1480 $this->verb=defaults::VERB_DELETE;1481 $this->method="removehotspot";1482 $this->getParameters()->set("hotspotid",$hotspotid);1483 }else{1484 throw new \Exception("HotSpot ID cant be empty");1485 }1486 }1487 /**1488 * @throws \Exception on invalid Parameters1489 */1490 public function addAward(string $award,string $category="",string $date="",string $state=""):void{1491 if(!empty($award)){1492 $this->verb=defaults::VERB_POST;1493 $this->method="addaward";1494 $this->getParameters()->set("award",$award);1495 if(!empty($category)){1496 $this->getParameters()->set("category",$category);1497 }1498 if(!empty($state)){1499 if(in_array($state,awardstates::getAllTypes())){1500 $this->getParameters()->set("state",$state);1501 }else{1502 throw new \Exception("state must be in ".implode(",",awardstates::getAllTypes()));1503 }1504 }1505 if(!empty($date)){1506 if(tools::dateIsValid($date)){1507 $this->getParameters()->set("date",$date);1508 }else{1509 throw new \Exception("Date must be in YYYY-MM-DD format");1510 }1511 }1512 }else{1513 throw new \Exception("Award cant be empty");1514 }1515 }1516 /**1517 * @throws \Exception on invalid Parameters1518 */1519 public function updateAward(int $awardid,string $award,string $category="",string $date="",string $state=""):void{1520 if(!empty($awardid)){1521 $this->verb=defaults::VERB_PUT;1522 $this->method="updateaward";1523 $this->getParameters()->set("awardid",$awardid);1524 if(!empty($award)){1525 $this->getParameters()->set("award",$award);1526 }1527 if(!empty($category)){1528 $this->getParameters()->set("category",$category);1529 }1530 if(!empty($state)){1531 if(in_array($state,awardstates::getAllTypes())){1532 $this->getParameters()->set("state",$state);1533 }else{1534 throw new \Exception("state must be in ".implode(",",awardstates::getAllTypes()));1535 }1536 }1537 if(!empty($date)){1538 if(tools::dateIsValid($date)){1539 $this->getParameters()->set("date",$date);1540 }else{1541 throw new \Exception("Date must be in YYYY-MM-DD format");1542 }1543 }1544 }else{1545 throw new \Exception("Award ID cant be empty");1546 }1547 }1548 /**1549 * @throws \Exception on invalid Parameters1550 */1551 public function removeAward(int $awardid):void{1552 if(!empty($awardid)){1553 $this->verb=defaults::VERB_DELETE;1554 $this->method="removeaward";1555 $this->getParameters()->set("awardid",$awardid);1556 }else{1557 throw new \Exception("Award ID cant be empty");1558 }1559 }1560}...
ComparisonClauseTest.php
Source:ComparisonClauseTest.php
...44 $this->qb->where($expr);45 $qb = Select::fromTable('entities', 'alias');46 $qb->where($qb->compare('x', '=', 'y'));47 $this->assertEquals($this->qb->getSQL(), $qb->getSQL());48 $this->assertEquals($this->qb->getParameters(), $qb->getParameters());49 }50 public function testCanNormalizeDateTime() {51 $dt = new \DateTime();52 $expr = $this->qb->expr()->eq('x', ':qb1');53 $this->qb->param($dt->getTimestamp(), ELGG_VALUE_INTEGER);54 $this->qb->where($expr);55 $qb = Select::fromTable('entities', 'alias');56 $qb->where($qb->compare('x', '=', $dt, ELGG_VALUE_TIMESTAMP));57 $this->assertEquals($this->qb->getSQL(), $qb->getSQL());58 $this->assertEquals($this->qb->getParameters(), $qb->getParameters());59 }60 public function testCanNormalizeDateString() {61 $date = 'July 20, 2017';62 $expr = $this->qb->expr()->eq('x', ':qb1');63 $this->qb->param((new \DateTime($date))->getTimestamp(), ELGG_VALUE_INTEGER);64 $this->qb->where($expr);65 $qb = Select::fromTable('entities', 'alias');66 $qb->where($qb->compare('x', '=', $date, ELGG_VALUE_TIMESTAMP));67 $this->assertEquals($this->qb->getSQL(), $qb->getSQL());68 $this->assertEquals($this->qb->getParameters(), $qb->getParameters());69 }70 public function testCanNormalizeTimestamp() {71 $date = time();72 $expr = $this->qb->expr()->eq('x', ':qb1');73 $this->qb->param($date, ELGG_VALUE_INTEGER);74 $this->qb->where($expr);75 $qb = Select::fromTable('entities', 'alias');76 $qb->where($qb->compare('x', '=', $date, ELGG_VALUE_TIMESTAMP));77 $this->assertEquals($this->qb->getSQL(), $qb->getSQL());78 $this->assertEquals($this->qb->getParameters(), $qb->getParameters());79 }80 public function testCanNormalizeGuids() {81 $object = (object) ['guid' => 25];82 $entity = $this->createObject();83 $input = [84 '10',85 $entity->guid,86 20,87 $object,88 [30, 35],89 ];90 $guids = [91 10, $entity->guid, 20, 25, 30, 3592 ];93 $expr = $this->qb->expr()->in('x', ':qb1');94 $this->qb->param($guids, ELGG_VALUE_INTEGER);95 $this->qb->where($expr);96 $qb = Select::fromTable('entities', 'alias');97 $qb->where($qb->compare('x', '=', $input, ELGG_VALUE_GUID));98 $this->assertEquals($this->qb->getSQL(), $qb->getSQL());99 $this->assertEquals($this->qb->getParameters(), $qb->getParameters());100 }101 public function testCanNormalizeIds() {102 $object = (object) ['id' => 20];103 $input = [104 '10',105 15,106 $object,107 [25, 30]108 ];109 $ids = [110 10, 15, 20, 25, 30111 ];112 $expr = $this->qb->expr()->in('x', ':qb1');113 $this->qb->param($ids, ELGG_VALUE_INTEGER);114 $this->qb->where($expr);115 $qb = Select::fromTable('entities', 'alias');116 $qb->where($qb->compare('x', '=', $input, ELGG_VALUE_ID));117 $this->assertEquals($this->qb->getSQL(), $qb->getSQL());118 $this->assertEquals($this->qb->getParameters(), $qb->getParameters());119 }120 public function testCanCompareCaseInsensitive() {121 $input = 'Abc';122 $expr = $this->qb->expr()->eq('x', ':qb1');123 $this->qb->param($input, ELGG_VALUE_STRING);124 $this->qb->where($expr);125 $qb = Select::fromTable('entities', 'alias');126 $qb->where($qb->compare('x', '=', $input, ELGG_VALUE_STRING, false));127 $this->assertEquals($this->qb->getSQL(), $qb->getSQL());128 $this->assertEquals($this->qb->getParameters(), $qb->getParameters());129 }130 public function testIgnoresCaseSensitiveFlagWithNonStringValue() {131 $input = '2';132 $int = 2;133 $expr = $this->qb->expr()->eq('x', ':qb1');134 $this->qb->param($int, ELGG_VALUE_INTEGER);135 $this->qb->where($expr);136 $qb = Select::fromTable('entities', 'alias');137 $qb->where($qb->compare('x', '=', $input, ELGG_VALUE_INTEGER, false));138 $this->assertEquals($this->qb->getSQL(), $qb->getSQL());139 $this->assertEquals($this->qb->getParameters(), $qb->getParameters());140 }141 public function testCanCompareArrayCaseInsensitive() {142 $input = [143 'Abc',144 'dEf',145 ];146 $expr = $this->qb->expr()->in('x', ':qb1');147 $this->qb->param($input, ELGG_VALUE_STRING);148 $this->qb->where($expr);149 $qb = Select::fromTable('entities', 'alias');150 $qb->where($qb->compare('x', '=', $input, ELGG_VALUE_STRING, false));151 $this->assertEquals($this->qb->getSQL(), $qb->getSQL());152 $this->assertEquals($this->qb->getParameters(), $qb->getParameters());153 }154 public function testIgnoresCaseSensitiveFlagWithNonStringArray() {155 $input = [156 1,157 '2',158 ];159 $ints = [160 1,161 2162 ];163 $expr = $this->qb->expr()->in('x', ':qb1');164 $this->qb->param($ints, ELGG_VALUE_INTEGER);165 $this->qb->where($expr);166 $qb = Select::fromTable('entities', 'alias');167 $qb->where($qb->compare('x', '=', $input, ELGG_VALUE_INTEGER, false));168 $this->assertEquals($this->qb->getSQL(), $qb->getSQL());169 $this->assertEquals($this->qb->getParameters(), $qb->getParameters());170 }171 public function testIgnoresCaseSensitiveFlagWithNonStringValues() {172 $input = [173 1,174 '2',175 ];176 $ints = [177 1,178 2179 ];180 $expr = $this->qb->expr()->in('x', ':qb1');181 $this->qb->param($ints, ELGG_VALUE_INTEGER);182 $this->qb->where($expr);183 $qb = Select::fromTable('entities', 'alias');184 $qb->where($qb->compare('x', '=', $input, ELGG_VALUE_INTEGER, false));185 $this->assertEquals($this->qb->getSQL(), $qb->getSQL());186 $this->assertEquals($this->qb->getParameters(), $qb->getParameters());187 }188 public function testCanCompareValueUsingIn() {189 $input = 5;190 $expr = $this->qb->expr()->in('x', ':qb1');191 $this->qb->param($input, ELGG_VALUE_INTEGER);192 $this->qb->where($expr);193 $qb = Select::fromTable('entities', 'alias');194 $qb->where($qb->compare('x', 'in', $input, ELGG_VALUE_INTEGER));195 $this->assertEquals($this->qb->getSQL(), $qb->getSQL());196 $this->assertEquals($this->qb->getParameters(), $qb->getParameters());197 }198 public function testCanCompareValueUsingEq() {199 $input = 5;200 $expr = $this->qb->expr()->eq('x', ':qb1');201 $this->qb->param($input, ELGG_VALUE_INTEGER);202 $this->qb->where($expr);203 $qb = Select::fromTable('entities', 'alias');204 $qb->where($qb->compare('x', 'eq', $input, ELGG_VALUE_INTEGER));205 $this->assertEquals($this->qb->getSQL(), $qb->getSQL());206 $this->assertEquals($this->qb->getParameters(), $qb->getParameters());207 }208 public function testCanCompareValueUsingEqualSign() {209 $input = 5;210 $expr = $this->qb->expr()->eq('x', ':qb1');211 $this->qb->param($input, ELGG_VALUE_INTEGER);212 $this->qb->where($expr);213 $qb = Select::fromTable('entities', 'alias');214 $qb->where($qb->compare('x', '=', $input, ELGG_VALUE_INTEGER));215 $this->assertEquals($this->qb->getSQL(), $qb->getSQL());216 $this->assertEquals($this->qb->getParameters(), $qb->getParameters());217 }218 public function testCanCompareArrayUsingIn() {219 $input = [5, 6];220 $expr = $this->qb->expr()->in('x', ':qb1');221 $this->qb->param($input, ELGG_VALUE_INTEGER);222 $this->qb->where($expr);223 $qb = Select::fromTable('entities', 'alias');224 $qb->where($qb->compare('x', 'in', $input, ELGG_VALUE_INTEGER));225 $this->assertEquals($this->qb->getSQL(), $qb->getSQL());226 $this->assertEquals($this->qb->getParameters(), $qb->getParameters());227 }228 public function testCanCompareArrayUsingEq() {229 $input = [5, 6];230 $expr = $this->qb->expr()->in('x', ':qb1');231 $this->qb->param($input, ELGG_VALUE_INTEGER);232 $this->qb->where($expr);233 $qb = Select::fromTable('entities', 'alias');234 $qb->where($qb->compare('x', 'eq', $input, ELGG_VALUE_INTEGER));235 $this->assertEquals($this->qb->getSQL(), $qb->getSQL());236 $this->assertEquals($this->qb->getParameters(), $qb->getParameters());237 }238 public function testCanCompareArrayUsingEqualSign() {239 $input = [5, 6];240 $expr = $this->qb->expr()->in('x', ':qb1');241 $this->qb->param($input, ELGG_VALUE_INTEGER);242 $this->qb->where($expr);243 $qb = Select::fromTable('entities', 'alias');244 $qb->where($qb->compare('x', 'eq', $input, ELGG_VALUE_INTEGER));245 $this->assertEquals($this->qb->getSQL(), $qb->getSQL());246 $this->assertEquals($this->qb->getParameters(), $qb->getParameters());247 }248 public function testCanCompareValueUsingNotIn() {249 $input = 5;250 $expr = $this->qb->expr()->notIn('x', ':qb1');251 $this->qb->param($input, ELGG_VALUE_INTEGER);252 $this->qb->where($expr);253 $qb = Select::fromTable('entities', 'alias');254 $qb->where($qb->compare('x', 'not in', $input, ELGG_VALUE_INTEGER));255 $this->assertEquals($this->qb->getSQL(), $qb->getSQL());256 $this->assertEquals($this->qb->getParameters(), $qb->getParameters());257 }258 public function testCanCompareValueUsingNeq() {259 $input = 5;260 $expr = $this->qb->expr()->neq('x', ':qb1');261 $this->qb->param($input, ELGG_VALUE_INTEGER);262 $this->qb->where($expr);263 $qb = Select::fromTable('entities', 'alias');264 $qb->where($qb->compare('x', 'neq', $input, ELGG_VALUE_INTEGER));265 $this->assertEquals($this->qb->getSQL(), $qb->getSQL());266 $this->assertEquals($this->qb->getParameters(), $qb->getParameters());267 }268 public function testCanCompareValueUsingNotEqualSign() {269 $input = 5;270 $expr = $this->qb->expr()->neq('x', ':qb1');271 $this->qb->param($input, ELGG_VALUE_INTEGER);272 $this->qb->where($expr);273 $qb = Select::fromTable('entities', 'alias');274 $qb->where($qb->compare('x', '!=', $input, ELGG_VALUE_INTEGER));275 $this->assertEquals($this->qb->getSQL(), $qb->getSQL());276 $this->assertEquals($this->qb->getParameters(), $qb->getParameters());277 }278 public function testCanCompareArrayUsingNotIn() {279 $input = [5, 6];280 $expr = $this->qb->expr()->notIn('x', ':qb1');281 $this->qb->param($input, ELGG_VALUE_INTEGER);282 $this->qb->where($expr);283 $qb = Select::fromTable('entities', 'alias');284 $qb->where($qb->compare('x', 'not in', $input, ELGG_VALUE_INTEGER));285 $this->assertEquals($this->qb->getSQL(), $qb->getSQL());286 $this->assertEquals($this->qb->getParameters(), $qb->getParameters());287 }288 public function testCanCompareArrayUsingNeq() {289 $input = [5, 6];290 $expr = $this->qb->expr()->notIn('x', ':qb1');291 $this->qb->param($input, ELGG_VALUE_INTEGER);292 $this->qb->where($expr);293 $qb = Select::fromTable('entities', 'alias');294 $qb->where($qb->compare('x', 'neq', $input, ELGG_VALUE_INTEGER));295 $this->assertEquals($this->qb->getSQL(), $qb->getSQL());296 $this->assertEquals($this->qb->getParameters(), $qb->getParameters());297 }298 public function testCanCompareArrayUsingNotEqualSign() {299 $input = [5, 6];300 $expr = $this->qb->expr()->notIn('x', ':qb1');301 $this->qb->param($input, ELGG_VALUE_INTEGER);302 $this->qb->where($expr);303 $qb = Select::fromTable('entities', 'alias');304 $qb->where($qb->compare('x', 'neq', $input, ELGG_VALUE_INTEGER));305 $this->assertEquals($this->qb->getSQL(), $qb->getSQL());306 $this->assertEquals($this->qb->getParameters(), $qb->getParameters());307 }308 /**309 * @dataProvider operatorComparison310 */311 public function testCanCompareUsingOtherOperators($input, $type, $normalized_input, $operator, $method, $boolean) {312 $parts = [];313 if (is_array($normalized_input)) {314 foreach ($normalized_input as $val) {315 $key = $this->qb->param($val, $type);316 $parts[] = $this->qb->expr()->$method('x', $key);317 }318 } else {319 $key = $this->qb->param($normalized_input, $type);320 $parts[] = $this->qb->expr()->$method('x', $key);321 }322 $expr = $this->qb->merge($parts, $boolean);323 $this->qb->where($expr);324 $qb = Select::fromTable('entities', 'alias');325 $qb->where($qb->compare('x', $operator, $input, $type));326 $this->assertEquals($this->qb->getSQL(), $qb->getSQL());327 $this->assertEquals($this->qb->getParameters(), $qb->getParameters());328 }329 public function operatorComparison() {330 return [331 ['%elgg', ELGG_VALUE_STRING, '%elgg', 'LIKE', 'like', 'or'],332 ['%elgg', ELGG_VALUE_STRING, '%elgg', 'like', 'like', 'or'],333 [5, ELGG_VALUE_STRING, '5', 'like', 'like', 'or'],334 [['%elgg', 'elgg%'], ELGG_VALUE_STRING, ['%elgg', 'elgg%'], 'like', 'like', 'or'],335 [[5, '6'], ELGG_VALUE_STRING, ['5', '6'], 'like', 'like', 'or'],336 ['%elgg', ELGG_VALUE_STRING, '%elgg', 'not like', 'notLike', 'and'],337 [5, ELGG_VALUE_STRING, '5', 'not like', 'notLike', 'and'],338 [['%elgg', 'elgg%'], ELGG_VALUE_STRING, ['%elgg', 'elgg%'], 'not like', 'notLike', 'and'],339 [[5, '6'], ELGG_VALUE_STRING, ['5', '6'], 'not like', 'notLike', 'and'],340 ['5', ELGG_VALUE_INTEGER, 5, '>', 'gt', 'or'],341 [['5', 6], ELGG_VALUE_INTEGER, [5, 6], '>', 'gt', 'or'],342 ['5', ELGG_VALUE_INTEGER, 5, 'gt', 'gt', 'or'],343 [['5', 6], ELGG_VALUE_INTEGER, [5, 6], 'gt', 'gt', 'or'],344 ['5', ELGG_VALUE_INTEGER, 5, '<', 'lt', 'or'],345 [['5', 6], ELGG_VALUE_INTEGER, [5, 6], '<', 'lt', 'or'],346 ['5', ELGG_VALUE_INTEGER, 5, 'lt', 'lt', 'or'],347 [['5', 6], ELGG_VALUE_INTEGER, [5, 6], 'lt', 'lt', 'or'],348 ['5', ELGG_VALUE_INTEGER, 5, '>=', 'gte', 'or'],349 [['5', 6], ELGG_VALUE_INTEGER, [5, 6], '>=', 'gte', 'or'],350 ['5', ELGG_VALUE_INTEGER, 5, 'gte', 'gte', 'or'],351 [['5', 6], ELGG_VALUE_INTEGER, [5, 6], 'gte', 'gte', 'or'],352 ];353 }354 public function testCanCompareArrayUsingIsNull() {355 $expr = $this->qb->expr()->isNull('x');356 $this->qb->where($expr);357 $qb = Select::fromTable('entities', 'alias');358 $qb->where($qb->compare('x', 'IS NULL'));359 $qb = Select::fromTable('entities', 'alias');360 $qb->where($qb->compare('x', 'is null', 'y'));361 $this->assertEquals($this->qb->getSQL(), $qb->getSQL());362 $this->assertEquals($this->qb->getParameters(), $qb->getParameters());363 }364 public function testCanCompareArrayUsingIsNotNull() {365 $expr = $this->qb->expr()->isNotNull('x');366 $this->qb->where($expr);367 $qb = Select::fromTable('entities', 'alias');368 $qb->where($qb->compare('x', 'IS NOT NULL'));369 $qb = Select::fromTable('entities', 'alias');370 $qb->where($qb->compare('x', 'is not null', 'y'));371 $this->assertEquals($this->qb->getSQL(), $qb->getSQL());372 $this->assertEquals($this->qb->getParameters(), $qb->getParameters());373 }374 public function testThrowsOnInvalidComparison() {375 $qb = Select::fromTable('entities', 'alias');376 377 $this->expectException(\InvalidParameterException::class);378 $qb->where($qb->compare('x', 'INVALID'));379 }380}...
SWParameterTest.php
Source:SWParameterTest.php
...21 $paramSpec = (SWParameter::inBody(new SchemaSpec('User', [])));22 $decorator = (new ParameterSpec('body', $paramSpec))->getDecorator();23 $operation = new Operation();24 $decorator($operation);25 self::assertTrue($operation->getParameters()->get('body')->isRequired());26 self::assertEquals(Parameter::IN_BODY, $operation->getParameters()->get('body')->getIn());27 }28 public function testInPath()29 {30 $paramSpec = (SWParameter::inPath('string', 'datetime'));31 $decorator = (new ParameterSpec('id', $paramSpec))->getDecorator();32 $operation = new Operation();33 $decorator($operation);34 self::assertTrue($operation->getParameters()->get('id')->isRequired());35 self::assertEquals(Parameter::IN_PATH, $operation->getParameters()->get('id')->getIn());36 self::assertEquals('string', $operation->getParameters()->get('id')->getType());37 self::assertEquals('datetime', $operation->getParameters()->get('id')->getFormat());38 }39 public function testInForm()40 {41 $paramSpec = (SWParameter::inForm('string', 'datetime'));42 $decorator = (new ParameterSpec('id', $paramSpec))->getDecorator();43 $operation = new Operation();44 $decorator($operation);45 self::assertEquals(Parameter::IN_FORM, $operation->getParameters()->get('id')->getIn());46 self::assertEquals('string', $operation->getParameters()->get('id')->getType());47 self::assertEquals('datetime', $operation->getParameters()->get('id')->getFormat());48 }49 public function testInQuery()50 {51 $paramSpec = (SWParameter::inQuery('string', 'datetime'));52 $decorator = (new ParameterSpec('id', $paramSpec))->getDecorator();53 $operation = new Operation();54 $decorator($operation);55 self::assertFalse($operation->getParameters()->get('id')->isRequired());56 self::assertEquals(Parameter::IN_QUERY, $operation->getParameters()->get('id')->getIn());57 self::assertEquals('string', $operation->getParameters()->get('id')->getType());58 self::assertEquals('datetime', $operation->getParameters()->get('id')->getFormat());59 }60 public function testInHeader()61 {62 $paramSpec = (SWParameter::inHeader('string', 'datetime'));63 $decorator = (new ParameterSpec('id', $paramSpec))->getDecorator();64 $operation = new Operation();65 $decorator($operation);66 self::assertFalse($operation->getParameters()->get('id')->isRequired());67 self::assertEquals(Parameter::IN_HEADER, $operation->getParameters()->get('id')->getIn());68 self::assertEquals('string', $operation->getParameters()->get('id')->getType());69 self::assertEquals('datetime', $operation->getParameters()->get('id')->getFormat());70 }71 public function testType()72 {73 $paramSpec = (SWParameter::type('string', 'datetime'));74 $decorator = (new ParameterSpec('id', $paramSpec))->getDecorator();75 $operation = new Operation();76 $decorator($operation);77 self::assertEquals('string', $operation->getParameters()->get('id')->getType());78 self::assertEquals('datetime', $operation->getParameters()->get('id')->getFormat());79 }80 public function testRequired()81 {82 $requiredParam = (new ParameterSpec('id', [SWParameter::required()]))->getDecorator();83 $requiredParam2 = (new ParameterSpec('id2', [SWParameter::required(true)]))->getDecorator();84 $notRequiredParam = (new ParameterSpec('idNot', [SWParameter::required(false)]))->getDecorator();85 $operation = new Operation();86 $requiredParam($operation);87 $requiredParam2($operation);88 $notRequiredParam($operation);89 self::assertTrue($operation->getParameters()->get('id')->isRequired());90 self::assertTrue($operation->getParameters()->get('id2')->isRequired());91 self::assertFalse($operation->getParameters()->get('idNot')->isRequired());92 }93 public function testDescription()94 {95 $decorator = (new ParameterSpec('id', [SWParameter::description('description')]))->getDecorator();96 $operation = new Operation();97 $decorator($operation);98 self::assertEquals('description', $operation->getParameters()->get('id')->getDescription());99 }100}...
getParameters
Using AI Code Generation
1$obj = new in();2$obj->getParameters();3$obj = new in();4$obj->getParameters();5$obj = new in();6$obj->getParameters();7$obj = new in();8$obj->getParameters();9$obj = new in();10$obj->getParameters();11$obj = new in();12$obj->getParameters();13$obj = new in();14$obj->getParameters();15$obj = new in();16$obj->getParameters();17$obj = new in();18$obj->getParameters();19$obj = new in();20$obj->getParameters();21$obj = new in();22$obj->getParameters();23$obj = new in();24$obj->getParameters();25$obj = new in();26$obj->getParameters();27$obj = new in();28$obj->getParameters();29$obj = new in();30$obj->getParameters();31$obj = new in();32$obj->getParameters();33$obj = new in();34$obj->getParameters();35$obj = new in();36$obj->getParameters();
getParameters
Using AI Code Generation
1$in = new Input();2$in->getParameters();3$in = new Input();4$in->getParameters();5$in = new Input();6$in->getParameters();7$in = new Input();8$in->getParameters();9$in = new Input();10$in->getParameters();11$in = new Input();12$in->getParameters();13$in = new Input();14$in->getParameters();15$in = new Input();16$in->getParameters();17$in = new Input();18$in->getParameters();19$in = new Input();20$in->getParameters();21$in = new Input();22$in->getParameters();23$in = new Input();24$in->getParameters();25$in = new Input();26$in->getParameters();27$in = new Input();28$in->getParameters();29$in = new Input();30$in->getParameters();31$in = new Input();32$in->getParameters();33$in = new Input();34$in->getParameters();
getParameters
Using AI Code Generation
1$test = new Test();2$test->getParameters();3$test = new Test();4$test->getParameters();5$test = new Test();6$test->getParameters();7$test = new Test();8$test->getParameters();9$test = new Test();10$test->getParameters();
getParameters
Using AI Code Generation
1$call = new getParameters();2$call->getParameters();3$call = new getParameters();4$call->getParameters();5$call = new getParameters();6$call->getParameters();7$call = new getParameters();8$call->getParameters();9$call = new getParameters();10$call->getParameters();11$call = new getParameters();12$call->getParameters();13$call = new getParameters();14$call->getParameters();15$call = new getParameters();16$call->getParameters();17$call = new getParameters();18$call->getParameters();19$call = new getParameters();20$call->getParameters();21$call = new getParameters();22$call->getParameters();23$call = new getParameters();24$call->getParameters();25$call = new getParameters();26$call->getParameters();27$call = new getParameters();28$call->getParameters();29$call = new getParameters();30$call->getParameters();31$call = new getParameters();32$call->getParameters();
getParameters
Using AI Code Generation
1{2 public function getParameters($url)3 {4 $url_parts = parse_url($url);5 parse_str($url_parts['query'], $params);6 return $params;7 }8}9require_once '1.php';10$object = new getParameters;11$parameters = $object->getParameters($url);12print_r($parameters);
getParameters
Using AI Code Generation
1require_once '2.php';2$my = new MyClass;3$my->getParameters();4class MyClass {5 public function getParameters() {6 $args = func_get_args();7 $num_args = func_num_args();8 echo "Number of arguments: $num_args"; 9 print_r($args);10 }11}
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Execute automation tests with getParameters on a cloud-based Grid of 3000+ real browsers and operating systems for both web and mobile applications.
Test now for FreeGet 100 minutes of automation test minutes FREE!!