File tree Expand file tree Collapse file tree 2 files changed +47
-0
lines changed Expand file tree Collapse file tree 2 files changed +47
-0
lines changed Original file line number Diff line number Diff line change 33
44namespace PleskX \Api \Operator ;
55
6+ use PleskX \Api \Struct \SiteAlias as Struct ;
7+
68class SiteAlias extends \PleskX \Api \Operator
79{
10+ /**
11+ * @param array $properties
12+ * @param array $preferences
13+ * @return Struct\Info
14+ */
15+ public function create (array $ properties , array $ preferences = [])
16+ {
17+ $ packet = $ this ->_client ->getPacket ();
18+ $ info = $ packet ->addChild ($ this ->_wrapperTag )->addChild ('create ' );
19+
20+ if (count ($ preferences ) > 0 ) {
21+ $ prefs = $ info ->addChild ('pref ' );
22+
23+ foreach ($ preferences as $ key => $ value ) {
24+ $ prefs ->addChild ($ key , is_bool ($ value ) ? ($ value ? 1 : 0 ) : $ value );
25+ }
26+ }
27+
28+ $ info ->addChild ('site-id ' , $ properties ['site-id ' ]);
29+ $ info ->addChild ('name ' , $ properties ['name ' ]);
30+
31+ $ response = $ this ->_client ->request ($ packet );
32+ return new Struct \Info ($ response );
33+ }
834
935}
Original file line number Diff line number Diff line change 1+ <?php
2+ // Copyright 1999-2016. Parallels IP Holdings GmbH.
3+
4+ namespace PleskX \Api \Struct \SiteAlias ;
5+
6+ class Info extends \PleskX \Api \Struct
7+ {
8+ /** @var string */
9+ public $ status ;
10+
11+ /** @var integer */
12+ public $ id ;
13+
14+ public function __construct ($ apiResponse )
15+ {
16+ $ this ->_initScalarProperties ($ apiResponse , [
17+ 'id ' ,
18+ 'status ' ,
19+ ]);
20+ }
21+ }
You can’t perform that action at this time.
0 commit comments