Example #1
0
 /**
  * Call method to find a matching parameter to return
  *
  * @param $name String name of function called
  * @param $parameters
  * @return String
  * @throws \InvalidArgumentException if not a valid parameter, or not a 'get' function
  */
 public function __call($name, $parameters)
 {
     if (!preg_match('/^get/', $name)) {
         throw new \InvalidArgumentException('No such function "' . $name . '"');
     }
     $name = preg_replace('/^get/', '', $name);
     $property_key = Gapi::array_key_exists_nc($name, $this->properties);
     if ($property_key) {
         return $this->properties[$property_key];
     }
     throw new \InvalidArgumentException('No valid property called "' . $name . '"');
 }
Example #2
0
 /**
  * Call method to find a matching metric or dimension to return
  *
  * @param $name String name of function called
  * @param $parameters
  * @return String
  * @throws \InvalidArgumentException if not a valid metric or dimensions, or not a 'get' function
  */
 public function __call($name, $parameters)
 {
     if (!preg_match('/^get/', $name)) {
         throw new \InvalidArgumentException('No such function "' . $name . '"');
     }
     $name = preg_replace('/^get/', '', $name);
     $metric_key = Gapi::array_key_exists_nc($name, $this->metrics);
     if ($metric_key) {
         return $this->metrics[$metric_key];
     }
     $dimension_key = Gapi::array_key_exists_nc($name, $this->dimensions);
     if ($dimension_key) {
         return $this->dimensions[$dimension_key];
     }
     throw new \InvalidArgumentException('No valid metric or dimesion called "' . $name . '"');
 }
Example #3
0
<?php

/*
* 2007-2015 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
*  @author PrestaShop SA <*****@*****.**>
*  @copyright  2007-2015 PrestaShop SA
*  @license    http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
*  International Registered Trademark & Property of PrestaShop SA
*/
include dirname(__FILE__) . '/../../config/config.inc.php';
include dirname(__FILE__) . '/gapi.php';
$gapi = new Gapi();
$gapi->api_3_0_oauth2callback();
Example #4
0
 /**
  * Call method to find a matching root parameter or 
  * aggregate metric to return
  *
  * @param $name String name of function called
  * @param $parameters array
  * @return String
  * @throws \Exception if not a valid parameter or aggregate
  * metric, or not a 'get' function
  */
 public function __call($name, $parameters)
 {
     if (!preg_match('/^get/', $name)) {
         throw new \InvalidArgumentException('No such function "' . $name . '"');
     }
     $name = preg_replace('/^get/', '', $name);
     $parameter_key = Gapi::array_key_exists_nc($name, $this->report_root_parameters);
     if ($parameter_key) {
         return $this->report_root_parameters[$parameter_key];
     }
     $aggregate_metric_key = Gapi::array_key_exists_nc($name, $this->report_aggregate_metrics);
     if ($aggregate_metric_key) {
         return $this->report_aggregate_metrics[$aggregate_metric_key];
     }
     throw new \InvalidArgumentException('No valid root parameter or aggregate metric called "' . $name . '"');
 }