Navigation Menu

Skip to content

Commit

Permalink
A little more linter cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
wjohnstondrip committed Jun 4, 2018
1 parent f3633f4 commit fbf41ae
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 111 deletions.
121 changes: 12 additions & 109 deletions phpcs.xml
Expand Up @@ -12,130 +12,33 @@
<arg name="parallel" value="75" />
<arg value="np"/>

<!-- Don't hide tokenizer exceptions -->
<!-- <rule ref="Internal.Tokenizer.Exception">
<type>error</type>
</rule> -->

<rule ref="PSR2">
<exclude name="PSR1.Methods.CamelCapsMethodName.NotCamelCaps" />
</rule>

<!-- Include the whole PEAR standard -->
<!-- <rule ref="PEAR">
<exclude name="PEAR.NamingConventions.ValidFunctionName" />
<exclude name="PEAR.NamingConventions.ValidVariableName" />
<exclude name="PEAR.Commenting.ClassComment" />
<exclude name="PEAR.Commenting.FileComment.MissingCategoryTag" />
<exclude name="PEAR.Commenting.FileComment.MissingPackageTag" />
<exclude name="PEAR.Commenting.FileComment.MissingLinkTag" />
<exclude name="PEAR.Commenting.FileComment.MissingVersion" />
<exclude name="PEAR.Commenting.InlineComment" />
</rule> -->

<!-- Include some sniffs from other standards that don't conflict with PEAR -->
<!-- <rule ref="Squiz.Arrays.ArrayBracketSpacing" />
<rule ref="Squiz.Arrays.ArrayDeclaration" />
<rule ref="Generic.PHP.ClosingPHPTag.Found"/>
<rule ref="Generic.Files.EndFileNoNewline.NotFound"/>
<rule ref="Generic.WhiteSpace.DisallowSpaceIndent.TabsUsed"/>
<rule ref="Generic.PHP.DeprecatedFunctions"/>
<rule ref="Generic.PHP.LowerCaseKeyword"/>
<rule ref="Generic.Strings.UnnecessaryStringConcat"/>
<rule ref="Generic.Commenting.Todo"/>
<rule ref="Generic.ControlStructures.InlineControlStructure"/>
<rule ref="Generic.Formatting.DisallowMultipleStatements"/>
<rule ref="Generic.Formatting.SpaceAfterCast"/>
<rule ref="Generic.NamingConventions.ConstructorName"/>
<rule ref="Squiz.Arrays.ArrayBracketSpacing" />
<rule ref="Squiz.ControlStructures.ControlSignature" />
<rule ref="Squiz.ControlStructures.ElseIfDeclaration" />
<rule ref="Squiz.Commenting.BlockComment" />
<rule ref="Squiz.Commenting.DocCommentAlignment" />
<rule ref="Squiz.Commenting.EmptyCatchComment" />
<rule ref="Squiz.Commenting.InlineComment" />
<rule ref="Squiz.Commenting.LongConditionClosingComment" />
<rule ref="Squiz.Commenting.PostStatementComment" />
<rule ref="Squiz.Commenting.VariableComment" />
<rule ref="Squiz.Formatting.OperatorBracket" />
<rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing" />
<rule ref="Squiz.Operators.ComparisonOperatorUsage" />
<rule ref="Squiz.PHP.DisallowInlineIf" />
<rule ref="Squiz.Scope.MethodScope" />
<rule ref="Squiz.Strings.ConcatenationSpacing" />
<rule ref="Squiz.WhiteSpace.ControlStructureSpacing" />
<rule ref="Squiz.WhiteSpace.OperatorSpacing" />
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace" />
<rule ref="Generic.Arrays.DisallowLongArraySyntax"/>
<rule ref="Generic.Commenting.Todo"/>
<rule ref="Generic.ControlStructures.InlineControlStructure"/>
<rule ref="Generic.Formatting.DisallowMultipleStatements"/>
<rule ref="Generic.Formatting.SpaceAfterCast"/>
<rule ref="Generic.NamingConventions.ConstructorName"/>
<rule ref="Generic.PHP.DeprecatedFunctions"/>
<rule ref="Generic.PHP.LowerCaseKeyword"/>
<rule ref="Generic.Strings.UnnecessaryStringConcat"/>
<rule ref="PSR2.Classes.PropertyDeclaration"/>
<rule ref="PSR2.Methods.MethodDeclaration"/>
<rule ref="PSR2.Files.EndFileNewline"/>
<rule ref="Zend.Files.ClosingTag"/> -->

<!-- PEAR uses warnings for inline control structures, so switch back to errors -->
<!-- <rule ref="Generic.ControlStructures.InlineControlStructure">
<properties>
<property name="error" value="true"/>
</properties>
</rule> -->

<!-- We use custom indent rules for arrays -->
<!-- <rule ref="Generic.Arrays.ArrayIndent"/>
<rule ref="Squiz.Arrays.ArrayDeclaration.KeyNotAligned">
<severity>0</severity>
</rule>
<rule ref="Squiz.Arrays.ArrayDeclaration.ValueNotAligned">
<severity>0</severity>
</rule>
<rule ref="Squiz.Arrays.ArrayDeclaration.CloseBraceNotAligned">
<severity>0</severity>
</rule>
<rule ref="Squiz.Arrays.ArrayDeclaration.CloseBraceNewLine">
<severity>0</severity>
</rule> -->

<!-- Check var names, but we don't want leading underscores for private vars -->
<!-- <rule ref="Squiz.NamingConventions.ValidVariableName" /> -->
<!-- <rule ref="Squiz.NamingConventions.ValidVariableName.PrivateNoUnderscore">
<severity>0</severity>
</rule> -->

<!-- Only one argument per line in multi-line function calls -->
<!-- <rule ref="PEAR.Functions.FunctionCallSignature">
<properties>
<property name="allowMultipleArguments" value="false"/>
</properties>
</rule> -->

<!-- Have 12 chars padding maximum and always show as errors -->
<!-- <rule ref="Generic.Formatting.MultipleStatementAlignment">
<properties>
<property name="maxPadding" value="12"/>
<property name="error" value="true"/>
</properties>
</rule> -->

<!-- Ban some functions -->
<!-- <rule ref="Generic.PHP.ForbiddenFunctions"> -->
<!-- <properties>
<property name="forbiddenFunctions" type="array">
<element key="sizeof" value="count"/>
<element key="delete" value="unset"/>
<element key="print" value="echo"/>
<element key="is_null" value="null"/>
<element key="create_function" value="null"/>
</property>
</properties> -->
<!-- </rule> -->

<!-- Private methods MUST not be prefixed with an underscore -->
<!-- <rule ref="PSR2.Methods.MethodDeclaration.Underscore">
<type>error</type>
</rule> -->

<!-- Private properties MUST not be prefixed with an underscore -->
<!-- <rule ref="PSR2.Classes.PropertyDeclaration.Underscore">
<type>error</type>
</rule> -->

<!-- The testing bootstrap file uses string concats to stop IDEs seeing the class aliases -->
<!-- <rule ref="Generic.Strings.UnnecessaryStringConcat">
<exclude-pattern>tests/bootstrap.php</exclude-pattern>
</rule> -->
</ruleset>
9 changes: 7 additions & 2 deletions src/Client.php
Expand Up @@ -16,10 +16,15 @@ class Client
{
const VERSION = '1.0.0';

/** @var string */
private $api_token = '';
/** @var string */
private $account_id = '';
/** @var string */
private $api_end_point = 'https://api.getdrip.com/v2/';
/** @var integer */
private $timeout = 30;
/** @var integer */
private $connect_timeout = 30;

/** @var callable */
Expand Down Expand Up @@ -136,7 +141,7 @@ public function fetch_subscriber($params)
if (!empty($params['subscriber_id'])) {
$subscriber_id = $params['subscriber_id'];
unset($params['subscriber_id']); // clear it from the params
} elseif (!empty($params['email'])) {
} else if (!empty($params['email'])) {
$subscriber_id = $params['email'];
unset($params['email']); // clear it from the params
} else {
Expand Down Expand Up @@ -189,7 +194,7 @@ public function unsubscribe_subscriber($params)
if (!empty($params['subscriber_id'])) {
$subscriber_id = $params['subscriber_id'];
unset($params['subscriber_id']); // clear it from the params
} elseif (!empty($params['email'])) {
} else if (!empty($params['email'])) {
$subscriber_id = $params['email'];
unset($params['email']); // clear it from the params
} else {
Expand Down

0 comments on commit fbf41ae

Please sign in to comment.