Skip to content

Commit

Permalink
Merge pull request #12 from ZeroRidge/master
Browse files Browse the repository at this point in the history
Fixes for SyncRestHandler/ServiceContext/Use Imports/Code Style
  • Loading branch information
hlu2 authored May 3, 2017
2 parents 28b1fb2 + e4c4449 commit 034204b
Show file tree
Hide file tree
Showing 4,652 changed files with 96,284 additions and 111,683 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
87 changes: 45 additions & 42 deletions bootstrape.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,50 +12,52 @@
$sdkDir = __DIR__ . DIRECTORY_SEPARATOR;


if (!defined('PATH_SDK_ROOT'))
define('PATH_SDK_ROOT', $sdkDir);
if (!defined('PATH_SDK_ROOT')) {
define('PATH_SDK_ROOT', $sdkDir);
}

// Specify POPO class path; typically a direct child of the SDK path
if (!defined('POPO_CLASS_PATH'))
define('POPO_CLASS_PATH', $sdkDir . 'Data' . DIRECTORY_SEPARATOR);
if (!defined('POPO_CLASS_PATH')) {
define('POPO_CLASS_PATH', $sdkDir . 'Data' . DIRECTORY_SEPARATOR);
}

/* PSR-4 Autoloader,QuickBooksOnline\Data;
spl_autoload_register(function ($class) {
//echo "class name is: " . $class ."\n";
/*
$delimitersArray = explode("\\" , $class);
if(count($delimitersArray) == 1){
//If it is without NameSpace, probably it is a old request for one of the
//POPO classes under Data Folder. Add the namespace prefix.
if(class_exists($class))
{
return;
}
else{
$class = 'QuickBooksOnline\\API\\Data\\' . $class;
if(class_exists($class))
{
return;
}
}
}
*
$prefix = 'QuickBooksOnline\\API\\';
$base_dir = __DIR__ . DIRECTORY_SEPARATOR;
$len = strlen($prefix);
if (strncmp($prefix, $class, $len) !== 0) {
//echo "class name is: " . $class ."\n";
/*
$delimitersArray = explode("\\" , $class);
if(count($delimitersArray) == 1){
//If it is without NameSpace, probably it is a old request for one of the
//POPO classes under Data Folder. Add the namespace prefix.
if(class_exists($class))
{
return;
}
else{
$class = 'QuickBooksOnline\\API\\Data\\' . $class;
if(class_exists($class))
{
return;
}
}
}
*
$prefix = 'QuickBooksOnline\\API\\';
$base_dir = __DIR__ . DIRECTORY_SEPARATOR;
$len = strlen($prefix);
if (strncmp($prefix, $class, $len) !== 0) {
// no, move to the next registered autoloader
return;
}
$relative_class = substr($class, $len);
$filewithoutExtension = $base_dir . str_replace('\\', '/', $relative_class);
$file = $filewithoutExtension. '.php';
//Below str_replace is for local testing. Remove it before putting on Composer.
if (file_exists($file) ) {
//echo "Register file is:" . $file . "\n";
require ($file);
}
});
$relative_class = substr($class, $len);
$filewithoutExtension = $base_dir . str_replace('\\', '/', $relative_class);
$file = $filewithoutExtension. '.php';
//Below str_replace is for local testing. Remove it before putting on Composer.
if (file_exists($file) ) {
//echo "Register file is:" . $file . "\n";
require ($file);
}
});
*/

// Include XSD2PHP dependencies for marshalling and unmarshalling
Expand All @@ -68,13 +70,14 @@
/*
set_include_path(get_include_path() . PATH_SEPARATOR . POPO_CLASS_PATH);
foreach (glob(POPO_CLASS_PATH.'*.php') as $filename){
//require_once "/Users/hlu2/Desktop/intuit_git/V3-PHP-SDK_openSourcePrepare/sdk/Data/IPPCustomer.php";
//echo "The file name is: " . $filename . "\n";
require_once $filename;
}
//require_once "/Users/hlu2/Desktop/intuit_git/V3-PHP-SDK_openSourcePrepare/sdk/Data/IPPCustomer.php";
//echo "The file name is: " . $filename . "\n";
require_once $filename;
}
*/

// Specify the prefix pre-pended to POPO class names. If you modify this value, you
// also need to rebuild the POPO classes, with the same prefix
if (!defined('PHP_CLASS_PREFIX'))
define('PHP_CLASS_PREFIX','IPP');
if (!defined('PHP_CLASS_PREFIX')) {
define('PHP_CLASS_PREFIX', 'IPP');
}
34 changes: 17 additions & 17 deletions src/Core/Configuration/BaseUrl.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,27 @@
*/
class BaseUrl
{
/**
* Gets or sets the url for QuickBooks Online Rest Service.
* @var string
*/
/**
* Gets or sets the url for QuickBooks Online Rest Service.
* @var string
*/
public $Qbo;

/**
* Gets or sets the url for Platform Rest Service.
* @var string
*/
/**
* Gets or sets the url for Platform Rest Service.
* @var string
*/
public $Ipp;

/**
* Initializes a new instance of the BaseUrl class.
*
* @param string $Qbo url for QuickBooks Online Rest Service
* @param string $Ipp url for Platform Rest Service
*/
public function __construct($Qbo=NULL, $Ipp=NULL)
/**
* Initializes a new instance of the BaseUrl class.
*
* @param string $Qbo url for QuickBooks Online Rest Service
* @param string $Ipp url for Platform Rest Service
*/
public function __construct($Qbo=null, $Ipp=null)
{
$this->Qbo=$Qbo;
$this->Ipp=$Ipp;
$this->Qbo=$Qbo;
$this->Ipp=$Ipp;
}
}
41 changes: 19 additions & 22 deletions src/Core/Configuration/ContentWriterSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,28 @@
use QuickBooksOnline\API\Exception\SdkException;
use QuickBooksOnline\API\Core\CoreConstants;


/**
* Description of ContentWriterSettings
* Update class with Constant Array. @Hao
* @author amatiushkin
*/
class ContentWriterSettings {


class ContentWriterSettings
{
public $strategy = null;
public $prefix = "ipp";
public $exportDir = null;
public $returnOject = false;


public static function checkStrategy($value) {
public static function checkStrategy($value)
{
$cleaned = strtolower(trim($value));
if(in_array($cleaned, self::getAllStrategies())) {
if (in_array($cleaned, self::getAllStrategies())) {
return $cleaned;
}
throw new SdkException("Incorrect strategy for ContentWriter."
. "It should be one of " . implode(", ", self::getAllStrategies())
.", but got $value");

}

/**
Expand All @@ -36,24 +34,24 @@ public static function checkStrategy($value) {
*/
public function verifyConfiguration()
{
if(($this->strategy === CoreConstants::EXPORT_STRATEGY) && !empty($this->strategy) ) {
if(is_null($this->exportDir)) {
throw new SdkException("Invalid value for exportDirectory property. It can not be null with 'export' strategy. ");
}
if (($this->strategy === CoreConstants::EXPORT_STRATEGY) && !empty($this->strategy)) {
if (is_null($this->exportDir)) {
throw new SdkException("Invalid value for exportDirectory property. It can not be null with 'export' strategy. ");
}
//clear file cache
clearstatcache();
if(!file_exists($this->exportDir)) {
throw new SdkException("Directory ({$this->exportDir}) doesn't exist.");
}
if (!file_exists($this->exportDir)) {
throw new SdkException("Directory ({$this->exportDir}) doesn't exist.");
}

if(!is_dir($this->exportDir)) {
throw new SdkException("Path ({$this->exportDir}) isn't a valid directory");
}
if (!is_dir($this->exportDir)) {
throw new SdkException("Path ({$this->exportDir}) isn't a valid directory");
}

if(!is_writable($this->exportDir)) {
throw new SdkException("Directory ({$this->exportDir}) isn't writable");
}
}
if (!is_writable($this->exportDir)) {
throw new SdkException("Directory ({$this->exportDir}) isn't writable");
}
}
}

/*
Expand All @@ -64,5 +62,4 @@ public static function getAllStrategies()
{
return CoreConstants::CONTENTWRITER_STRATEGIES;
}

}
100 changes: 50 additions & 50 deletions src/Core/Configuration/IppConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,63 +6,63 @@
*/
class IppConfiguration
{
/**
* Gets or sets the Logger mechanism.
* @var Logger
*/
public $Logger;
/**
* Gets or sets the Logger mechanism.
* @var Logger
*/
public $Logger;

/**
* Gets or sets the Security mechanism like OAuth, Cookie.
* @var RequestValidator
*/
public $Security;
/**
* Gets or sets the Security mechanism like OAuth, Cookie.
* @var RequestValidator
*/
public $Security;

/**
* Gets or sets the Message settings like Compression, Serialiation.
* @var Message
*/
public $Message;
/**
* Gets or sets the Message settings like Compression, Serialiation.
* @var Message
*/
public $Message;

/**
* Gets or sets the Retry Policy used to retry service calls when Retry-able Exceptions are generated.
* @var IntuitRetryPolicy
*/
public $RetryPolicy;
/**
* Gets or sets the Retry Policy used to retry service calls when Retry-able Exceptions are generated.
* @var IntuitRetryPolicy
*/
public $RetryPolicy;

/**
* Gets or sets the Base Urls like Pre-Production url's.
* @var BaseUrl
*/
public $BaseUrl;
/**
* Gets or sets the Base Urls like Pre-Production url's.
* @var BaseUrl
*/
public $BaseUrl;

/**
* Provide configuration for ContentWriter
* @var ContentWriterSettings
*/
public $ContentWriter;
/**
* Provide configuration for ContentWriter
* @var ContentWriterSettings
*/
public $ContentWriter;

/**
* Gets or sets global or entity or operation level execution rights
* @var OperationControlList
*/
public $OpControlList;
/**
* Gets or sets global or entity or operation level execution rights
* @var OperationControlList
*/
public $OpControlList;

/**
* Contains value for minor version
* @var Integer
*/
public $minorVersion;
/**
* Contains value for minor version
* @var Integer
*/
public $minorVersion;

/**
* Contains value for SSL check
* @var Boolean
*/
public $SSLCheckStatus;
/**
* Contains value for SSL check
* @var Boolean
*/
public $SSLCheckStatus;

/**
* Contains the RealmID associated with the Compnay
* @var string
*/
public $RealmID;
/**
* Contains the RealmID associated with the Compnay
* @var string
*/
public $RealmID;
}
Loading

0 comments on commit 034204b

Please sign in to comment.