Guest User

Untitled

a guest
Sep 11th, 2018
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 26.28 KB | None | 0 0
  1. /**
  2.  * A simple class that defines a URL.
  3.  */
  4. @class URL
  5.     protected:
  6.         /**The scheme part of the url: http, https, ftp, etc.*/
  7.         string scheme (rw);
  8.         /**The host of the url: google.com, facebook.com ...*/
  9.         string host (rw);
  10.         /**The port of the url: 80, 90, 8080, etc.*/
  11.         integer port (rw);
  12.         /**The user for the url: kylekirby, etc.*/
  13.         string user (rw);
  14.         /**The password for the url: p@$$w0|2d*/
  15.         string password (rw);
  16.         /**The path for the url: /index.php*/
  17.         string path (rw);
  18.         /**The query for the url, sans ?: page=root&id=12*/
  19.         string query (rw);
  20.         /**The fragment for the url, sans #: myInlineAnchor*/
  21.         string fragment (rw);
  22.        
  23.         /**A stored id for the cache.*/
  24.         string cacheId;
  25.         /**The stored cache.*/
  26.         string cache;
  27.        
  28.         /**
  29.          * @return string A newly built cache ID for the
  30.          * current configuration.
  31.          */
  32.         - (string) getCurrentCacheId;
  33.         <?
  34.             return md5(
  35.                 $this->getScheme() .
  36.                 $this->getHost() .
  37.                 $this->getPort() .
  38.                 $this->getUser() .
  39.                 $this->getPassword() .
  40.                 $this->getPath() .
  41.                 $this->getQuery() .
  42.                 $this->getFragment()
  43.             );
  44.         ?>
  45.        
  46.         /**Builds the URL based on the current configuration.*/
  47.         - (void) build;
  48.         <?
  49.             $url  = $this->getScheme() . '://';
  50.             if($user = $this->getUser()){
  51.                 $url .= $user;
  52.                 if($pasword = $this->getPassword()){
  53.                     $url .= ':' . $pasword;
  54.                 }
  55.                 $url .= '@';
  56.             }
  57.             $url .= $this->getHost();
  58.             if($port = $this->getPort()){
  59.                 $url .= ':' . $port;
  60.             }
  61.             $url .= '/' . ltrim($this->getPath(),'/');
  62.             if($query = $this->getQuery()){
  63.                 $url .= '?' . $query;
  64.             }
  65.             if($fragment = $this->getFragment()){
  66.                 $url .= '#' . $fragment;
  67.             }
  68.             $this->_setCache(
  69.                 $url
  70.             );
  71.             $this->_setCacheId(
  72.                 $this->_getCurrentCacheId()
  73.             );
  74.         ?>
  75.     public:
  76.         - (void) __construct: (string)url = null;
  77.         <?
  78.             if($url){
  79.                 $this->parse($url);
  80.             }
  81.         ?>
  82.        
  83.         /**
  84.          * Parse a URL and populate the parts
  85.          * into this class.
  86.          */
  87.         - (void) parse: (string)url;
  88.         <?
  89.             $parts = parse_url($url);
  90.             $this->setScheme($parts['scheme']);
  91.             $this->setHost($parts['host']);
  92.             $this->setPort($parts['port']);
  93.             $this->setUser($parts['user']);
  94.             $this->setPassword($parts['pass']);
  95.             $this->setPath($parts['path']);
  96.             $this->setQuery($parts['query']);
  97.             $this->setFragment($parts['fragment']);
  98.             $this->_setCache(null);
  99.         ?>
  100.        
  101.         /**
  102.          * @return string The built URL based on the
  103.          * current configuration.
  104.          */
  105.         - (string) get;
  106.         <?
  107.             if(!$this->_getCache() || $this->_getCurrentCacheId() !== $this->_getCacheId()){
  108.                 $this->_build();
  109.             }
  110.             return $this->_getCache();
  111.         ?>
  112.        
  113.         - (string) __toString;
  114.         <?
  115.             return $this->get();
  116.         ?>
  117. @end
  118.  
  119. /**
  120.  * An interface that defines how a stream
  121.  * should behave.
  122.  */
  123. @interface Stream
  124.     public:
  125.         /**Read a specified amount of bytes*/
  126.         - (string) readBytes: (integer)bytes;
  127.         /**Read a single character.*/
  128.         - (string) readChar;
  129.         /**Read an entire line.*/
  130.         - (string) readLine;
  131.         /**Read the entire stream, until EOF.*/
  132.         - (string) readAll;
  133.         /**Rewind the internal pointer.*/
  134.         - (boolean) rewind;
  135.         /**Write a chunk of data to the stream.*/
  136.         - (integer) write: (string)content;
  137.         /**Offset the internal pointer by $offset.*/
  138.         - (integer) seek: (integer)offset;
  139.         /**Get information about the stream.*/
  140.         - (array) stat;
  141. @end
  142.  
  143. /**
  144.  * An abstract wrapper for built in PHP
  145.  * stream resources. Simply implement
  146.  * the get resource method.
  147.  */
  148. @abstract StreamWrapper implements Stream
  149.     public:
  150.         - (resource) getResource;
  151.         - (string) readBytes: (integer)bytes;
  152.         <?
  153.             return fread($this->getResource(),$bytes);
  154.         ?>
  155.         - (string) readChar;
  156.         <?
  157.             return fgetc($this->getResource());
  158.         ?>
  159.         - (string) readLine;
  160.         <?
  161.             return fgets($this->getResource());
  162.         ?>
  163.         - (string) readAll;
  164.         <?
  165.             ob_start();
  166.             fpassthru($this->getResource());
  167.             return ob_get_clean();
  168.         ?>     
  169.         - (boolean) rewind;
  170.         <?
  171.             return rewind($this->getResource());
  172.         ?>
  173.         - (integer) seek:(integer)offset;
  174.         <?
  175.             return fseek($this->getResource(),$offset);
  176.         ?>
  177.         - (integer) write: (string)content;
  178.         <?
  179.             fwrite($this->getResource(),$content);
  180.         ?>
  181.         - (array) stat;
  182.         <?
  183.             return fstat($this->getResource());
  184.         ?>
  185. @end
  186.  
  187. /**
  188.  * A stream for temporary data.
  189.  */
  190. @class TempStream extends StreamWrapper
  191.     protected:
  192.         resource resource (ro) = {fopen('php://temp','rw')};
  193. @end
  194.  
  195. @abstract Request
  196.     protected:
  197.         URL url (rw);
  198.         Stream post (rw);
  199.     public:
  200.         - (void) execute;
  201. @end
  202.  
  203. @class MBloxRequest
  204.     protected:
  205.         string partnerName (rw);
  206.         string partnerPassword (rw);
  207.         string message (rw);
  208.         string senderId (rw);
  209.         string operator (rw);
  210.         string subscriberNumber (rw);
  211.         string requestUrl (rw);
  212.        
  213.     public:
  214.         - (string) queue;
  215.         <?
  216.             // yeah
  217.         ?>
  218. @end
  219.  
  220. ==== Creates ====
  221.  
  222. <?php
  223. /**
  224.  * A simple class that defines a URL.
  225.  */
  226. class URL {
  227.     /**
  228.      * The scheme part of the url: http, https, ftp, etc.
  229.      *
  230.      * @param string scheme
  231.      */
  232.     protected $_scheme;
  233.    
  234.     /**
  235.      * The host of the url: google.com, facebook.com ...
  236.      *
  237.      * @param string host
  238.      */
  239.     protected $_host;
  240.    
  241.     /**
  242.      * The port of the url: 80, 90, 8080, etc.
  243.      *
  244.      * @param integer port
  245.      */
  246.     protected $_port;
  247.    
  248.     /**
  249.      * The user for the url: kylekirby, etc.
  250.      *
  251.      * @param string user
  252.      */
  253.     protected $_user;
  254.    
  255.     /**
  256.      * The password for the url: p@$$w0|2d
  257.      *
  258.      * @param string password
  259.      */
  260.     protected $_password;
  261.    
  262.     /**
  263.      * The path for the url: /index.php
  264.      *
  265.      * @param string path
  266.      */
  267.     protected $_path;
  268.    
  269.     /**
  270.      * The query for the url, sans ?: page=root&id=12
  271.      *
  272.      * @param string query
  273.      */
  274.     protected $_query;
  275.    
  276.     /**
  277.      * The fragment for the url, sans #: myInlineAnchor
  278.      *
  279.      * @param string fragment
  280.      */
  281.     protected $_fragment;
  282.    
  283.     /**
  284.      * A stored id for the cache.
  285.      *
  286.      * @param string cacheId
  287.      */
  288.     protected $_cacheId;
  289.    
  290.     /**
  291.      * The stored cache.
  292.      *
  293.      * @param string cache
  294.      */
  295.     protected $_cache;
  296.  
  297.     /**
  298.      * @uses self::$_scheme
  299.      * @return string scheme
  300.      */
  301.     public function getScheme(){
  302.         return $this->_scheme;
  303.     }
  304.    
  305.     /**
  306.      * @param string $scheme
  307.      * @uses self::$_scheme
  308.      * @return void
  309.      */
  310.     public function setScheme($scheme){
  311.         $arguments = func_get_args();
  312.         if(isset($arguments[0]) && !is_string($arguments[0])){
  313.             throw new Exception('An ' . gettype($scheme) . ' was passed to argument $scheme on method URL::setScheme(); however a string was expected.');
  314.         }
  315.         unset($arguments);
  316.         $this->_scheme = $scheme;
  317.         return $this;
  318.     }
  319.    
  320.     /**
  321.      * @uses self::$_host
  322.      * @return string host
  323.      */
  324.     public function getHost(){
  325.         return $this->_host;
  326.     }
  327.    
  328.     /**
  329.      * @param string $host
  330.      * @uses self::$_host
  331.      * @return void
  332.      */
  333.     public function setHost($host){
  334.         $arguments = func_get_args();
  335.         if(isset($arguments[0]) && !is_string($arguments[0])){
  336.             throw new Exception('An ' . gettype($host) . ' was passed to argument $host on method URL::setHost(); however a string was expected.');
  337.         }
  338.         unset($arguments);
  339.         $this->_host = $host;
  340.         return $this;
  341.     }
  342.    
  343.     /**
  344.      * @uses self::$_port
  345.      * @return integer port
  346.      */
  347.     public function getPort(){
  348.         return $this->_port;
  349.     }
  350.    
  351.     /**
  352.      * @param integer $port
  353.      * @uses self::$_port
  354.      * @return void
  355.      */
  356.     public function setPort($port){
  357.         $arguments = func_get_args();
  358.         if(isset($arguments[0]) && !is_integer($arguments[0])){
  359.             throw new Exception('An ' . gettype($port) . ' was passed to argument $port on method URL::setPort(); however a integer was expected.');
  360.         }
  361.         unset($arguments);
  362.         $this->_port = $port;
  363.         return $this;
  364.     }
  365.    
  366.     /**
  367.      * @uses self::$_user
  368.      * @return string user
  369.      */
  370.     public function getUser(){
  371.         return $this->_user;
  372.     }
  373.    
  374.     /**
  375.      * @param string $user
  376.      * @uses self::$_user
  377.      * @return void
  378.      */
  379.     public function setUser($user){
  380.         $arguments = func_get_args();
  381.         if(isset($arguments[0]) && !is_string($arguments[0])){
  382.             throw new Exception('An ' . gettype($user) . ' was passed to argument $user on method URL::setUser(); however a string was expected.');
  383.         }
  384.         unset($arguments);
  385.         $this->_user = $user;
  386.         return $this;
  387.     }
  388.    
  389.     /**
  390.      * @uses self::$_password
  391.      * @return string password
  392.      */
  393.     public function getPassword(){
  394.         return $this->_password;
  395.     }
  396.    
  397.     /**
  398.      * @param string $password
  399.      * @uses self::$_password
  400.      * @return void
  401.      */
  402.     public function setPassword($password){
  403.         $arguments = func_get_args();
  404.         if(isset($arguments[0]) && !is_string($arguments[0])){
  405.             throw new Exception('An ' . gettype($password) . ' was passed to argument $password on method URL::setPassword(); however a string was expected.');
  406.         }
  407.         unset($arguments);
  408.         $this->_password = $password;
  409.         return $this;
  410.     }
  411.    
  412.     /**
  413.      * @uses self::$_path
  414.      * @return string path
  415.      */
  416.     public function getPath(){
  417.         return $this->_path;
  418.     }
  419.    
  420.     /**
  421.      * @param string $path
  422.      * @uses self::$_path
  423.      * @return void
  424.      */
  425.     public function setPath($path){
  426.         $arguments = func_get_args();
  427.         if(isset($arguments[0]) && !is_string($arguments[0])){
  428.             throw new Exception('An ' . gettype($path) . ' was passed to argument $path on method URL::setPath(); however a string was expected.');
  429.         }
  430.         unset($arguments);
  431.         $this->_path = $path;
  432.         return $this;
  433.     }
  434.    
  435.     /**
  436.      * @uses self::$_query
  437.      * @return string query
  438.      */
  439.     public function getQuery(){
  440.         return $this->_query;
  441.     }
  442.    
  443.     /**
  444.      * @param string $query
  445.      * @uses self::$_query
  446.      * @return void
  447.      */
  448.     public function setQuery($query){
  449.         $arguments = func_get_args();
  450.         if(isset($arguments[0]) && !is_string($arguments[0])){
  451.             throw new Exception('An ' . gettype($query) . ' was passed to argument $query on method URL::setQuery(); however a string was expected.');
  452.         }
  453.         unset($arguments);
  454.         $this->_query = $query;
  455.         return $this;
  456.     }
  457.    
  458.     /**
  459.      * @uses self::$_fragment
  460.      * @return string fragment
  461.      */
  462.     public function getFragment(){
  463.         return $this->_fragment;
  464.     }
  465.    
  466.     /**
  467.      * @param string $fragment
  468.      * @uses self::$_fragment
  469.      * @return void
  470.      */
  471.     public function setFragment($fragment){
  472.         $arguments = func_get_args();
  473.         if(isset($arguments[0]) && !is_string($arguments[0])){
  474.             throw new Exception('An ' . gettype($fragment) . ' was passed to argument $fragment on method URL::setFragment(); however a string was expected.');
  475.         }
  476.         unset($arguments);
  477.         $this->_fragment = $fragment;
  478.         return $this;
  479.     }
  480.    
  481.     /**
  482.      * @uses self::$_cacheId
  483.      * @return string cacheId
  484.      */
  485.     protected function _getCacheId(){
  486.         return $this->_cacheId;
  487.     }
  488.    
  489.     /**
  490.      * @param string $cacheId
  491.      * @uses self::$_cacheId
  492.      * @return void
  493.      */
  494.     protected function _setCacheId($cacheId){
  495.         $arguments = func_get_args();
  496.         if(isset($arguments[0]) && !is_string($arguments[0])){
  497.             throw new Exception('An ' . gettype($cacheId) . ' was passed to argument $cacheId on method URL::setCacheId(); however a string was expected.');
  498.         }
  499.         unset($arguments);
  500.         $this->_cacheId = $cacheId;
  501.         return $this;
  502.     }
  503.    
  504.     /**
  505.      * @uses self::$_cache
  506.      * @return string cache
  507.      */
  508.     protected function _getCache(){
  509.         return $this->_cache;
  510.     }
  511.    
  512.     /**
  513.      * @param string $cache
  514.      * @uses self::$_cache
  515.      * @return void
  516.      */
  517.     protected function _setCache($cache){
  518.         $arguments = func_get_args();
  519.         if(isset($arguments[0]) && !is_string($arguments[0])){
  520.             throw new Exception('An ' . gettype($cache) . ' was passed to argument $cache on method URL::setCache(); however a string was expected.');
  521.         }
  522.         unset($arguments);
  523.         $this->_cache = $cache;
  524.         return $this;
  525.     }
  526.    
  527.     /**
  528.      * @return string A newly built cache ID for the
  529.      * current configuration.
  530.      */
  531.     protected function _getCurrentCacheId(){
  532.         return md5(
  533.             $this->getScheme() .
  534.             $this->getHost() .
  535.             $this->getPort() .
  536.             $this->getUser() .
  537.             $this->getPassword() .
  538.             $this->getPath() .
  539.             $this->getQuery() .
  540.             $this->getFragment()
  541.         );
  542.     }
  543.    
  544.     /**
  545.      * Builds the URL based on the current configuration.
  546.      *
  547.      * @return void
  548.      */
  549.     protected function _build(){
  550.         $url  = $this->getScheme() . '://';
  551.         if($user = $this->getUser()){
  552.             $url .= $user;
  553.             if($pasword = $this->getPassword()){
  554.                 $url .= ':' . $pasword;
  555.             }
  556.             $url .= '@';
  557.         }
  558.         $url .= $this->getHost();
  559.         if($port = $this->getPort()){
  560.             $url .= ':' . $port;
  561.         }
  562.         $url .= '/' . ltrim($this->getPath(),'/');
  563.         if($query = $this->getQuery()){
  564.             $url .= '?' . $query;
  565.         }
  566.         if($fragment = $this->getFragment()){
  567.             $url .= '#' . $fragment;
  568.         }
  569.         $this->_setCache(
  570.             $url
  571.         );
  572.         $this->_setCacheId(
  573.             $this->_getCurrentCacheId()
  574.         );
  575.     }
  576.    
  577.     /**
  578.      * @param string $url
  579.      * @return void
  580.      */
  581.     public function __construct($url = null){
  582.         $arguments = func_get_args();
  583.         if(isset($arguments[0]) && !is_string($arguments[0])){
  584.             throw new Exception('An ' . gettype($url) . ' was passed to argument $url on method URL::__construct(); however a string was expected.');
  585.         }
  586.         unset($arguments);
  587.         if($url){
  588.             $this->parse($url);
  589.         }
  590.     }
  591.    
  592.     /**
  593.      * Parse a URL and populate the parts
  594.      * into this class.
  595.      *
  596.      * @param string $url
  597.      * @return void
  598.      */
  599.     public function parse($url){
  600.         $arguments = func_get_args();
  601.         if(isset($arguments[0]) && !is_string($arguments[0])){
  602.             throw new Exception('An ' . gettype($url) . ' was passed to argument $url on method URL::parse(); however a string was expected.');
  603.         }
  604.         unset($arguments);
  605.         $parts = parse_url($url);
  606.         $this->setScheme($parts['scheme']);
  607.         $this->setHost($parts['host']);
  608.         $this->setPort($parts['port']);
  609.         $this->setUser($parts['user']);
  610.         $this->setPassword($parts['pass']);
  611.         $this->setPath($parts['path']);
  612.         $this->setQuery($parts['query']);
  613.         $this->setFragment($parts['fragment']);
  614.         $this->_setCache(null);
  615.     }
  616.    
  617.     /**
  618.      * @return string The built URL based on the
  619.      * current configuration.
  620.      */
  621.     public function get(){
  622.         if(!$this->_getCache() || $this->_getCurrentCacheId() !== $this->_getCacheId()){
  623.             $this->_build();
  624.         }
  625.         return $this->_getCache();
  626.     }
  627.    
  628.     /**
  629.      * @return string
  630.      */
  631.     public function __toString(){
  632.         return $this->get();
  633.     }
  634. }
  635.  
  636. /**
  637.  * An interface that defines how a stream
  638.  * should behave.
  639.  */
  640. interface Stream {
  641.     /**
  642.      * Read a specified amount of bytes
  643.      *
  644.      * @param integer $bytes
  645.      * @return string
  646.      */
  647.     public function readBytes($bytes);
  648.    
  649.     /**
  650.      * Read a single character.
  651.      *
  652.      * @return string
  653.      */
  654.     public function readChar();
  655.    
  656.     /**
  657.      * Read an entire line.
  658.      *
  659.      * @return string
  660.      */
  661.     public function readLine();
  662.    
  663.     /**
  664.      * Read the entire stream, until EOF.
  665.      *
  666.      * @return string
  667.      */
  668.     public function readAll();
  669.    
  670.     /**
  671.      * Rewind the internal pointer.
  672.      *
  673.      * @return boolean
  674.      */
  675.     public function rewind();
  676.    
  677.     /**
  678.      * Write a chunk of data to the stream.
  679.      *
  680.      * @param string $content
  681.      * @return integer
  682.      */
  683.     public function write($content);
  684.    
  685.     /**
  686.      * Offset the internal pointer by $offset.
  687.      *
  688.      * @param integer $offset
  689.      * @return integer
  690.      */
  691.     public function seek($offset);
  692.    
  693.     /**
  694.      * Get information about the stream.
  695.      *
  696.      * @return array
  697.      */
  698.     public function stat();
  699. }
  700.  
  701. /**
  702.  * An abstract wrapper for built in PHP
  703.  * stream resources. Simply implement
  704.  * the get resource method.
  705.  */
  706. abstract class StreamWrapper {
  707.     /**
  708.      * @return resource
  709.      */
  710.     public abstract function getResource();
  711.    
  712.     /**
  713.      * @param integer $bytes
  714.      * @return string
  715.      */
  716.     public function readBytes($bytes){
  717.         $arguments = func_get_args();
  718.         if(isset($arguments[0]) && !is_integer($arguments[0])){
  719.             throw new Exception('An ' . gettype($bytes) . ' was passed to argument $bytes on method StreamWrapper::readBytes(); however a integer was expected.');
  720.         }
  721.         unset($arguments);
  722.         return fread($this->getResource(),$bytes);
  723.     }
  724.    
  725.     /**
  726.      * @return string
  727.      */
  728.     public function readChar(){
  729.         return fgetc($this->getResource());
  730.     }
  731.    
  732.     /**
  733.      * @return string
  734.      */
  735.     public function readLine(){
  736.         return fgets($this->getResource());
  737.     }
  738.    
  739.     /**
  740.      * @return string
  741.      */
  742.     public function readAll(){
  743.         ob_start();
  744.         fpassthru($this->getResource());
  745.         return ob_get_clean();
  746.     }
  747.    
  748.     /**
  749.      * @return boolean
  750.      */
  751.     public function rewind(){
  752.         return rewind($this->getResource());
  753.     }
  754.    
  755.     /**
  756.      * @param integer $offset
  757.      * @return integer
  758.      */
  759.     public function seek($offset){
  760.         $arguments = func_get_args();
  761.         if(isset($arguments[0]) && !is_integer($arguments[0])){
  762.             throw new Exception('An ' . gettype($offset) . ' was passed to argument $offset on method StreamWrapper::seek(); however a integer was expected.');
  763.         }
  764.         unset($arguments);
  765.         return fseek($this->getResource(),$offset);
  766.     }
  767.    
  768.     /**
  769.      * @param string $content
  770.      * @return integer
  771.      */
  772.     public function write($content){
  773.         $arguments = func_get_args();
  774.         if(isset($arguments[0]) && !is_string($arguments[0])){
  775.             throw new Exception('An ' . gettype($content) . ' was passed to argument $content on method StreamWrapper::write(); however a string was expected.');
  776.         }
  777.         unset($arguments);
  778.         fwrite($this->getResource(),$content);
  779.     }
  780.    
  781.     /**
  782.      * @return array
  783.      */
  784.     public function stat(){
  785.         return fstat($this->getResource());
  786.     }
  787. }
  788.  
  789. /**
  790.  * A stream for temporary data.
  791.  */
  792. class TempStream extends StreamWrapper {
  793.     /**
  794.      * @param resource resource
  795.      */
  796.     protected $_resource;
  797.  
  798.     /**
  799.      * @uses self::$_resource
  800.      * @return resource resource
  801.      */
  802.     public function getResource(){
  803.         if($this->_resource === null){
  804.             $this->_resource = fopen('php://temp','rw');
  805.         }
  806.         return $this->_resource;
  807.     }
  808. }
  809.  
  810. abstract class Request {
  811.     /**
  812.      * @param URL url
  813.      */
  814.     protected $_url;
  815.    
  816.     /**
  817.      * @param Stream post
  818.      */
  819.     protected $_post;
  820.  
  821.     /**
  822.      * @uses self::$_url
  823.      * @return URL url
  824.      */
  825.     public function getUrl(){
  826.         return $this->_url;
  827.     }
  828.    
  829.     /**
  830.      * @param URL $url
  831.      * @uses self::$_url
  832.      * @return void
  833.      */
  834.     public function setUrl(URL $url){
  835.         $this->_url = $url;
  836.         return $this;
  837.     }
  838.    
  839.     /**
  840.      * @uses self::$_post
  841.      * @return Stream post
  842.      */
  843.     public function getPost(){
  844.         return $this->_post;
  845.     }
  846.    
  847.     /**
  848.      * @param Stream $post
  849.      * @uses self::$_post
  850.      * @return void
  851.      */
  852.     public function setPost(Stream $post){
  853.         $this->_post = $post;
  854.         return $this;
  855.     }
  856.    
  857.     /**
  858.      * @return void
  859.      */
  860.     public abstract function execute();
  861. }
  862.  
  863. class MBloxRequest {
  864.     /**
  865.      * @param string partnerName
  866.      */
  867.     protected $_partnerName;
  868.    
  869.     /**
  870.      * @param string partnerPassword
  871.      */
  872.     protected $_partnerPassword;
  873.    
  874.     /**
  875.      * @param string message
  876.      */
  877.     protected $_message;
  878.    
  879.     /**
  880.      * @param string senderId
  881.      */
  882.     protected $_senderId;
  883.    
  884.     /**
  885.      * @param string operator
  886.      */
  887.     protected $_operator;
  888.    
  889.     /**
  890.      * @param string subscriberNumber
  891.      */
  892.     protected $_subscriberNumber;
  893.    
  894.     /**
  895.      * @param string requestUrl
  896.      */
  897.     protected $_requestUrl;
  898.  
  899.     /**
  900.      * @uses self::$_partnerName
  901.      * @return string partnerName
  902.      */
  903.     public function getPartnerName(){
  904.         return $this->_partnerName;
  905.     }
  906.    
  907.     /**
  908.      * @param string $partnerName
  909.      * @uses self::$_partnerName
  910.      * @return void
  911.      */
  912.     public function setPartnerName($partnerName){
  913.         $arguments = func_get_args();
  914.         if(isset($arguments[0]) && !is_string($arguments[0])){
  915.             throw new Exception('An ' . gettype($partnerName) . ' was passed to argument $partnerName on method MBloxRequest::setPartnerName(); however a string was expected.');
  916.         }
  917.         unset($arguments);
  918.         $this->_partnerName = $partnerName;
  919.         return $this;
  920.     }
  921.    
  922.     /**
  923.      * @uses self::$_partnerPassword
  924.      * @return string partnerPassword
  925.      */
  926.     public function getPartnerPassword(){
  927.         return $this->_partnerPassword;
  928.     }
  929.    
  930.     /**
  931.      * @param string $partnerPassword
  932.      * @uses self::$_partnerPassword
  933.      * @return void
  934.      */
  935.     public function setPartnerPassword($partnerPassword){
  936.         $arguments = func_get_args();
  937.         if(isset($arguments[0]) && !is_string($arguments[0])){
  938.             throw new Exception('An ' . gettype($partnerPassword) . ' was passed to argument $partnerPassword on method MBloxRequest::setPartnerPassword(); however a string was expected.');
  939.         }
  940.         unset($arguments);
  941.         $this->_partnerPassword = $partnerPassword;
  942.         return $this;
  943.     }
  944.    
  945.     /**
  946.      * @uses self::$_message
  947.      * @return string message
  948.      */
  949.     public function getMessage(){
  950.         return $this->_message;
  951.     }
  952.    
  953.     /**
  954.      * @param string $message
  955.      * @uses self::$_message
  956.      * @return void
  957.      */
  958.     public function setMessage($message){
  959.         $arguments = func_get_args();
  960.         if(isset($arguments[0]) && !is_string($arguments[0])){
  961.             throw new Exception('An ' . gettype($message) . ' was passed to argument $message on method MBloxRequest::setMessage(); however a string was expected.');
  962.         }
  963.         unset($arguments);
  964.         $this->_message = $message;
  965.         return $this;
  966.     }
  967.    
  968.     /**
  969.      * @uses self::$_senderId
  970.      * @return string senderId
  971.      */
  972.     public function getSenderId(){
  973.         return $this->_senderId;
  974.     }
  975.    
  976.     /**
  977.      * @param string $senderId
  978.      * @uses self::$_senderId
  979.      * @return void
  980.      */
  981.     public function setSenderId($senderId){
  982.         $arguments = func_get_args();
  983.         if(isset($arguments[0]) && !is_string($arguments[0])){
  984.             throw new Exception('An ' . gettype($senderId) . ' was passed to argument $senderId on method MBloxRequest::setSenderId(); however a string was expected.');
  985.         }
  986.         unset($arguments);
  987.         $this->_senderId = $senderId;
  988.         return $this;
  989.     }
  990.    
  991.     /**
  992.      * @uses self::$_operator
  993.      * @return string operator
  994.      */
  995.     public function getOperator(){
  996.         return $this->_operator;
  997.     }
  998.    
  999.     /**
  1000.      * @param string $operator
  1001.      * @uses self::$_operator
  1002.      * @return void
  1003.      */
  1004.     public function setOperator($operator){
  1005.         $arguments = func_get_args();
  1006.         if(isset($arguments[0]) && !is_string($arguments[0])){
  1007.             throw new Exception('An ' . gettype($operator) . ' was passed to argument $operator on method MBloxRequest::setOperator(); however a string was expected.');
  1008.         }
  1009.         unset($arguments);
  1010.         $this->_operator = $operator;
  1011.         return $this;
  1012.     }
  1013.    
  1014.     /**
  1015.      * @uses self::$_subscriberNumber
  1016.      * @return string subscriberNumber
  1017.      */
  1018.     public function getSubscriberNumber(){
  1019.         return $this->_subscriberNumber;
  1020.     }
  1021.    
  1022.     /**
  1023.      * @param string $subscriberNumber
  1024.      * @uses self::$_subscriberNumber
  1025.      * @return void
  1026.      */
  1027.     public function setSubscriberNumber($subscriberNumber){
  1028.         $arguments = func_get_args();
  1029.         if(isset($arguments[0]) && !is_string($arguments[0])){
  1030.             throw new Exception('An ' . gettype($subscriberNumber) . ' was passed to argument $subscriberNumber on method MBloxRequest::setSubscriberNumber(); however a string was expected.');
  1031.         }
  1032.         unset($arguments);
  1033.         $this->_subscriberNumber = $subscriberNumber;
  1034.         return $this;
  1035.     }
  1036.    
  1037.     /**
  1038.      * @uses self::$_requestUrl
  1039.      * @return string requestUrl
  1040.      */
  1041.     public function getRequestUrl(){
  1042.         return $this->_requestUrl;
  1043.     }
  1044.    
  1045.     /**
  1046.      * @param string $requestUrl
  1047.      * @uses self::$_requestUrl
  1048.      * @return void
  1049.      */
  1050.     public function setRequestUrl($requestUrl){
  1051.         $arguments = func_get_args();
  1052.         if(isset($arguments[0]) && !is_string($arguments[0])){
  1053.             throw new Exception('An ' . gettype($requestUrl) . ' was passed to argument $requestUrl on method MBloxRequest::setRequestUrl(); however a string was expected.');
  1054.         }
  1055.         unset($arguments);
  1056.         $this->_requestUrl = $requestUrl;
  1057.         return $this;
  1058.     }
  1059.    
  1060.     /**
  1061.      * @return string
  1062.      */
  1063.     public function queue(){
  1064.         // yeah
  1065.     }
  1066. }
  1067. ?>
Add Comment
Please, Sign In to add comment