Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release/0.0.0 #18

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.idea/
vendor/
composer.lock
18 changes: 18 additions & 0 deletions VERSION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Versions

## v0.0.0

### Comments

* Initial pre-release tag for composer so people don't have to track master in their packages.
* Additionally this allows aliasing in composer.json, allowing people to point at this repository and automatically
track the main repository again when it releases anything higher than 0.0.0

### Updates

* Added Quality Assurance Tools to composers require-dev, as well as configuration files for each

### Bug Fixes

* Merged dkorrel/soap-client bd635e84a62067b0013f89324b797b88de0d6939 to fix update/upsert
* Altered this to make it PSR-2 compliant
10 changes: 10 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@
"psr/log": "*"
},
"require-dev": {
"phpunit/phpunit": "^4.5",
"squizlabs/php_codesniffer": "^2.2",
"phploc/phploc": "^2.0",
"phpmd/phpmd": "^2.2",
"sebastian/phpcpd": "^2.0",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’m not really a fan of adding all those tools in require-dev. I much prefer a Scrutinizer solution, which centralises quality assurance. I just added this repo to Scrutinizer. Maybe try what this .scrutinizer.yml will yield?

imports:
  - php

tools:
  external_code_coverage: true

"doctrine/common": ">=2.3"
},
"suggest": {
Expand All @@ -27,5 +32,10 @@
"psr-0": {
"Phpforce\\SoapClient": "src"
}
},
"autoload-dev": {
"psr-0": {
"Phpforce\\SoapClient\\Test": "tests"
}
}
}
10 changes: 10 additions & 0 deletions phpcs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0"?>
<ruleset name="Rules for phpforce">
<description>Used for maintaining standards in phpforce</description>

<file>./src</file>
<file>./tests</file>

<rule ref="PSR1"/>
<rule ref="PSR2"/>
</ruleset>
20 changes: 20 additions & 0 deletions phpmd.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0"?>
<ruleset name="PHPMD rule set for phpforce/common"
xmlns="http://pmd.sf.net/ruleset/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0
http://pmd.sf.net/ruleset_xml_schema.xsd"
xsi:noNamespaceSchemaLocation="
http://pmd.sf.net/ruleset_xml_schema.xsd">
<description>
Rulesets to check phpforce against
</description>

<!-- Import the entire unused code rule set -->
<rule ref="rulesets/cleancode.xml" />
<rule ref="rulesets/codesize.xml" />
<rule ref="rulesets/controversial.xml" />
<rule ref="rulesets/design.xml" />
<rule ref="rulesets/naming.xml" />
<rule ref="rulesets/unusedcode.xml" />
</ruleset>
2 changes: 1 addition & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>

<phpunit bootstrap="./tests/bootstrap.php" colors="true">
<phpunit bootstrap="./vendor/autoload.php" colors="true">
<testsuites>
<testsuite name="Phpforce SOAP client Test Suite">
<directory suffix="Test.php">./tests/</directory>
Expand Down
5 changes: 3 additions & 2 deletions src/Phpforce/SoapClient/BulkSaver.php
Original file line number Diff line number Diff line change
Expand Up @@ -285,9 +285,10 @@ private function flushUpserts($objectType)
$result = $this->client->upsert(
$this->bulkUpsertMatchFields[$objectType],
$this->bulkUpsertRecords[$objectType],
$objectType);
$objectType
);
$this->bulkUpsertRecords[$objectType] = array();

return $result;
}
}
}
12 changes: 6 additions & 6 deletions src/Phpforce/SoapClient/BulkSaverInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@

namespace Phpforce\SoapClient;

use Phpforce\SoapClient\Response\SaveResult;
use Phpforce\SoapClient\Result\SaveResult;

interface BulkSaverInterface
{
/**
* Save a record in bulk
*
* @param object $record
* @param object $object The record data as an object
* @param string $objectType The record type, e.g., Account
* @param string $matchField Optional match field for upserts
* @return BulkSaver
*/
function save($object, $objectType, $matchField = null);
public function save($object, $objectType, $matchField = null);

/**
* Delete a record in bulk
Expand All @@ -23,12 +23,12 @@ function save($object, $objectType, $matchField = null);
* property with non-empty value
* @return BulkSaver
*/
function delete($record);
public function delete($record);

/**
* Flush all creates, updates and upserts
*
* @return SaveResult[]
*/
function flush();
}
public function flush();
}
6 changes: 1 addition & 5 deletions src/Phpforce/SoapClient/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,6 @@ protected function createSoapVars(array $objects, $type)
$soapVars = array();

foreach ($objects as $object) {

$sObject = $this->createSObject($object, $type);

$xml = '';
Expand Down Expand Up @@ -490,8 +489,7 @@ protected function fixFieldsToNullXml(\SoapVar $object)
{
if (isset($object->enc_value->fieldsToNull)
&& is_array($object->enc_value->fieldsToNull)
&& count($object->enc_value->fieldsToNull) > 0)
{
&& count($object->enc_value->fieldsToNull) > 0) {
$xml = '';
foreach ($object->enc_value->fieldsToNull as $fieldToNull) {
$xml .= '<fieldsToNull>' . $fieldToNull . '</fieldsToNull>';
Expand All @@ -516,7 +514,6 @@ protected function checkResult(array $results, array $params)
$exceptions = new Exception\SaveException();

for ($i = 0; $i < count($results); $i++) {

// If the param was an (s)object, set it’s Id field
if (is_object($params[$i])
&& (!isset($params[$i]->Id) || null === $params[$i]->Id)
Expand Down Expand Up @@ -698,4 +695,3 @@ protected function createSObject($object, $objectType)
return $sObject;
}
}

1 change: 0 additions & 1 deletion src/Phpforce/SoapClient/ClientBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,3 @@ public function build()
return $client;
}
}

1 change: 0 additions & 1 deletion src/Phpforce/SoapClient/ClientInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -279,4 +279,3 @@ public function sendEmail(array $emails);
*/
public function setPassword($userId, $password);
}

2 changes: 1 addition & 1 deletion src/Phpforce/SoapClient/Event/FaultEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ public function setRequestEvent(RequestEvent $requestEvent)
{
$this->requestEvent = $requestEvent;
}
}
}
1 change: 0 additions & 1 deletion src/Phpforce/SoapClient/Event/RequestEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,3 @@ public function setResponse($response)
$this->response = $response;
}
}

1 change: 0 additions & 1 deletion src/Phpforce/SoapClient/Event/ResponseEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,3 @@ public function getResponse()
return $this->response;
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,4 @@ public function getLogging()
{
return $this->logging;
}
}
}
1 change: 0 additions & 1 deletion src/Phpforce/SoapClient/Events.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,3 @@ final class Events
const RESPONSE = 'phpforce.soap_client.response';
const FAULT = 'phpforce.soap_client.fault';
}

2 changes: 1 addition & 1 deletion src/Phpforce/SoapClient/Exception/DeleteException.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ public function setErrors($errors)
{
$this->errors = $errors;
}
}
}
5 changes: 2 additions & 3 deletions src/Phpforce/SoapClient/Exception/SaveException.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ public function add($result)
if (count($errors) > 0) {
return $errors[0]->getMessage();
}
}, $this->results
)
}, $this->results)
);
}

Expand All @@ -33,4 +32,4 @@ public function count()
{
return count($this->results);
}
}
}
2 changes: 1 addition & 1 deletion src/Phpforce/SoapClient/Plugin/LogPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,4 @@ public static function getSubscribedEvents()
'phpforce.soap_client.fault' => 'onClientFault'
);
}
}
}
2 changes: 1 addition & 1 deletion src/Phpforce/SoapClient/Request/BaseEmail.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
class BaseEmail
{
public $subject;
}
}
2 changes: 1 addition & 1 deletion src/Phpforce/SoapClient/Request/EmailFileAttachment.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ class EmailFileAttachment
public $contentType;
public $fileName;
public $inline;
}
}
2 changes: 1 addition & 1 deletion src/Phpforce/SoapClient/Request/LeadConvert.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ class LeadConvert
public $overwriteLeadSource = false;
public $ownerId;
public $sendNotificationEmail = false;
}
}
2 changes: 1 addition & 1 deletion src/Phpforce/SoapClient/Request/MergeRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ class MergeRequest
{
public $masterRecord;
public $recordToMergeIds = array();
}
}
2 changes: 1 addition & 1 deletion src/Phpforce/SoapClient/Request/SingleEmailMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ class SingleEmailMessage extends BaseEmail
public $toAddresses;
public $whatId;
public $orgWideEmailAddressId;
}
}
2 changes: 1 addition & 1 deletion src/Phpforce/SoapClient/Result/ChildRelationship.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ public function getRelationshipName()
{
return $this->relationshipName;
}
}
}
2 changes: 1 addition & 1 deletion src/Phpforce/SoapClient/Result/DeleteResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@

class DeleteResult extends SaveResult
{
}
}
2 changes: 1 addition & 1 deletion src/Phpforce/SoapClient/Result/DeletedRecord.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ public function getId()
{
return $this->id;
}
}
}
2 changes: 1 addition & 1 deletion src/Phpforce/SoapClient/Result/DescribeGlobalResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ class DescribeGlobalResult
public $maxBatchSize;
/** @var DescribeGlobalSObjectResult[] */
public $sobjects = array();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ class DescribeGlobalSObjectResult
public $triggerable;
public $undeletable;
public $updateable;
}
}
2 changes: 1 addition & 1 deletion src/Phpforce/SoapClient/Result/DescribeSObjectResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -263,4 +263,4 @@ public function getRelationshipField($name)
return $name === $field->getName();
})->first();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -238,4 +238,4 @@ public function references($object)

return false;
}
}
}
18 changes: 0 additions & 18 deletions src/Phpforce/SoapClient/Result/DescribeTabSetResult.php

This file was deleted.

2 changes: 1 addition & 1 deletion src/Phpforce/SoapClient/Result/EmptyRecycleBinResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
class EmptyRecycleBinResult extends SaveResult
{

}
}
2 changes: 1 addition & 1 deletion src/Phpforce/SoapClient/Result/Error.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ public function getStatusCode()
{
return $this->statusCode;
}
}
}
2 changes: 1 addition & 1 deletion src/Phpforce/SoapClient/Result/GetDeletedResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ public function getDeletedRecords()
{
return $this->deletedRecords;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ public function getTimestamp()
{
return $this->timestamp;
}
}
}
2 changes: 1 addition & 1 deletion src/Phpforce/SoapClient/Result/GetUpdatedResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ public function getLatestDateCovered()
{
return $this->latestDateCovered;
}
}
}
2 changes: 1 addition & 1 deletion src/Phpforce/SoapClient/Result/GetUserInfoResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -226,4 +226,4 @@ public function getOrgDefaultCurrencyIsoCode()
{
return $this->orgDefaultCurrencyIsoCode;
}
}
}
1 change: 0 additions & 1 deletion src/Phpforce/SoapClient/Result/LeadConvertResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,3 @@ class LeadConvertResult
public $success;
public $errors;
}

2 changes: 0 additions & 2 deletions src/Phpforce/SoapClient/Result/MergeResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,3 @@ public function getMergedRecordIds()
return $this->mergedRecordIds;
}
}


Loading