/** * The constructor for the shop class. * * @author David Pauli <*****@*****.**> * @since 0.0.0 * @since 0.1.1 Save the own login credentials. * @api * @param String $host The ePages host to connect. * @param String $shop The refered ePages shop. * @param String $authToken The authentificaton token to connect via REST. * @param boolean $isssl True, if you use SSL, false if not. Default value is true. * @source 2 1 Calls the REST client and connect. */ function __construct($host, $shop, $authToken, $isssl = true) { if (!InputValidator::isHost($host) || !InputValidator::isShop($shop)) { return; } $this->host = $host; $this->shop = $shop; $this->authToken = $authToken; $this->isssl = $isssl; RESTClient::connect($this->host, $this->shop, $this->authToken, $this->isssl); }
/** * The constructor for the main class. * * @param String $host The ePages host to connect. * @param String $shop The refered ePages shop. * @param String $authToken The authentificaton token to connect via REST. * @param boolean $isssl True, if you use SSL, false if not. Default value is true. */ public static function connect($host, $shop, $authToken, $isssl) { if (!InputValidator::isHost($host) || !InputValidator::isShop($shop) || !InputValidator::isAuthToken($authToken)) { self::$ISCONNECTED = false; return; } self::$HOST = $host; self::$SHOP = $shop; self::$ISSSL = $isssl; self::$AUTHTOKEN = $authToken; self::$ISCONNECTED = true; }
/** * The constructor for the main class. * * @author David Pauli <*****@*****.**> * @since 0.0.0 * @since 0.0.1 Use disconnect function on wrong parameters. * @api * @param String $host The epages host to connect. * @param String $shop The refered ePages shop. * @param String $authToken The authentificaton token to connect via REST. * @param boolean $isssl True, if you use SSL, false if not. Default value is true. */ public static function connect($host, $shop, $authToken, $isssl) { // check parameter if (!InputValidator::isHost($host) || !InputValidator::isShop($shop)) { self::disconnect(); return false; } self::$HOST = $host; self::$SHOP = $shop; self::$ISSSL = $isssl; self::$AUTHTOKEN = $authToken; self::$ISCONNECTED = true; return true; }
/** * The constructor for the main class. * * @author David Pauli <*****@*****.**> * @param String $host The epages host to connect. * @param String $shop The refered ePages shop. * @param String $authToken The authentificaton token to connect via REST. * @param boolean $isssl True, if you use SSL, false if not. Default value is true. * @since 0.0.0 * @since 0.0.1 Use disconnect function on wrong parameters. * @since 0.1.2 Throw warning with wrong parameters. * @since 0.1.2 Add error reporting. */ public static function connect($host, $shop, $authToken = null, $isssl = true) { self::errorReset(); // check parameters if (!InputValidator::isHost($host) || !InputValidator::isShop($shop)) { Logger::warning("ep6\\RESTClient\nHost (" . $host . ") or Shop (" . $shop . ") are not valid."); self::disconnect(); $error = !InputValidator::isHost($host) ? "RESTC-1" : "RESTC-2"; self::errorSet($error); return false; } self::$HOST = $host; self::$SHOP = $shop; self::$ISSSL = $isssl; self::$AUTHTOKEN = $authToken; self::$ISCONNECTED = true; return true; }
/** * @group utility */ function testIsShop() { $this->assertFalse(InputValidator::isShop(null)); $this->assertFalse(InputValidator::isShop("")); $this->assertTrue(InputValidator::isShop("SomeString")); }
/** * The constructor for the shop class. * * @author David Pauli <*****@*****.**> * @param String $host The ePages host to connect. * @param String $shop The refered ePages shop. * @param String $authToken The authentificaton token to connect via REST. * @param boolean $isssl True, if you use SSL, false if not. Default value is true. * @since 0.0.0 * @since 0.1.1 Save the own login credentials. * @since 0.1.2 Add error reporting. * @since 0.1.3 Load shop attributes. */ function __construct($host, $shop, $authToken, $isssl = true) { if (!InputValidator::isHost($host) || !InputValidator::isShop($shop)) { Logger::warning("ep6\\Shop\nHost (" . $host . ") or Shop (" . $shop . ") are not valid."); $error = !InputValidator::isHost($host) ? "S-1" : "S-2"; self::setError($error); return; } $this->host = $host; $this->shop = $shop; $this->authToken = $authToken; $this->isssl = $isssl; RESTClient::connect($this->host, $this->shop, $this->authToken, $this->isssl); }