Skip to content
This repository has been archived by the owner on Feb 1, 2021. It is now read-only.

Commit

Permalink
Use PHP CS Fixer and update .travis.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
keradus committed Nov 16, 2014
1 parent 1e9a7f9 commit 558479d
Show file tree
Hide file tree
Showing 21 changed files with 220 additions and 73 deletions.
9 changes: 5 additions & 4 deletions .travis.yml
@@ -1,8 +1,9 @@
language: php

before_script: composer install --dev

php:
- 5.3
- 5.4
- 5.3
- 5.4

install:
- travis_retry composer install --no-interaction --prefer-source
- vendor/bin/php-cs-fixer --diff --dry-run fix .
1 change: 1 addition & 0 deletions composer.json
Expand Up @@ -27,6 +27,7 @@
"sensiolabs/ansi-to-html": "~1.0"
},
"require-dev": {
"fabpot/php-cs-fixer": "~1.0",
"phpunit/phpunit": "3.7.*",
"symfony/browser-kit": "~2.2",
"symfony/css-selector": "~2.2.0",
Expand Down
168 changes: 157 additions & 11 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/Sismo/BitbucketProject.php
Expand Up @@ -39,7 +39,7 @@ public function setRepository($url)
$repo = preg_split('/\//', $this->getRepository());

$this->setUrlPattern(sprintf('https://bitbucket.org/%s/commits/%%commit%%', $this->getRepository()));
$this->setBitBucketRepository( sprintf('git@bitbucket.org:/%s.git', $this->getRepository()) );
$this->setBitBucketRepository(sprintf('git@bitbucket.org:/%s.git', $this->getRepository()));
} else {
throw new \InvalidArgumentException(sprintf('URL "%s" does not look like a BitBucket repository.', $this->getRepository()));
}
Expand Down
19 changes: 9 additions & 10 deletions src/Sismo/Contrib/AndroidPushC2DMNotifier.php
Expand Up @@ -46,7 +46,7 @@ class AndroidPushC2DMNotifier extends Notifier
* @param string $service
*/
public function __construct($username, $password, $deviceRegistrationId, $messageFormat = '',
$source = 'Company-AppName-Version', $msgType = 'SismoNotifierMsgType', $service='ac2dm')
$source = 'Company-AppName-Version', $msgType = 'SismoNotifierMsgType', $service = 'ac2dm')
{
$this->authCode = $this->getGoogleAuthCodeHelper($username, $password, $source, $service);
$this->deviceRegistrationId = $deviceRegistrationId;
Expand All @@ -58,11 +58,11 @@ public function notify(Commit $commit)
{
$message = $this->format($this->messageFormat, $commit);

$headers = array('Authorization: GoogleLogin auth=' . $this->authCode);
$headers = array('Authorization: GoogleLogin auth='.$this->authCode);
$data = array(
'registration_id' => $this->deviceRegistrationId,
'collapse_key' => $this->msgType,
'data.message' => $message
'data.message' => $message,
);

$ch = curl_init();
Expand All @@ -89,19 +89,19 @@ public function notify(Commit $commit)
return true;
}

public function getGoogleAuthCodeHelper($username, $password, $source='Company-AppName-Version', $service='ac2dm')
public function getGoogleAuthCodeHelper($username, $password, $source = 'Company-AppName-Version', $service = 'ac2dm')
{
$ch = curl_init();
if (!$ch) {
return false;
}

curl_setopt($ch, CURLOPT_URL, "https://www.google.com/accounts/ClientLogin");
$postFields = "accountType=" . urlencode('HOSTED_OR_GOOGLE')
. "&Email=" . urlencode($username)
. "&Passwd=" . urlencode($password)
. "&source=" . urlencode($source)
. "&service=" . urlencode($service);
$postFields = "accountType=".urlencode('HOSTED_OR_GOOGLE')
."&Email=".urlencode($username)
."&Passwd=".urlencode($password)
."&source=".urlencode($source)
."&service=".urlencode($service);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postFields);
Expand All @@ -128,6 +128,5 @@ public function getGoogleAuthCodeHelper($username, $password, $source='Company-A

return $matches[2];
}

}
// @codeCoverageIgnoreEnd
4 changes: 2 additions & 2 deletions src/Sismo/Contrib/CrossFingerNotifier.php
Expand Up @@ -48,7 +48,7 @@ public function __construct($notifiers = array())
/**
* Notifies a commit.
*
* @param Commit $commit Then Commit instance
* @param Commit $commit Then Commit instance
* @return Boolean whether notification has been sent or not
*/
public function notify(Commit $commit)
Expand All @@ -68,7 +68,7 @@ public function notify(Commit $commit)
* Determines if a build needs to be notify
* based on his status and his predecessor's one
*
* @param Commit $commit The commit to analyse
* @param Commit $commit The commit to analyse
* @return Boolean whether the commit need notification or not
*/
protected function commitNeedNotification(Commit $commit)
Expand Down
18 changes: 9 additions & 9 deletions src/Sismo/Contrib/GithubNotifier.php
Expand Up @@ -40,8 +40,8 @@ class GithubNotifier extends Notifier
protected $targetUrlPattern = null;

/**
* @param string $apikey personal API key
* @param string $repo repository name, e.g. fabpot/Sismo
* @param string $apikey personal API key
* @param string $repo repository name, e.g. fabpot/Sismo
* @param string $targetUrlPattern status target URL pattern, e.g. http://sismo/%slug%/%sha%
*/
public function __construct($apikey, $repo, $targetUrlPattern = null)
Expand All @@ -53,7 +53,7 @@ public function __construct($apikey, $repo, $targetUrlPattern = null)
}

/**
* @param string $context
* @param string $context
* @return $this
*/
public function setContext($context)
Expand All @@ -64,7 +64,7 @@ public function setContext($context)
}

/**
* @param string $description
* @param string $description
* @return $this
*/
public function setDescription($description)
Expand All @@ -75,7 +75,7 @@ public function setDescription($description)
}

/**
* @param string $host
* @param string $host
* @return $this
*/
public function setHost($host)
Expand All @@ -86,7 +86,7 @@ public function setHost($host)
}

/**
* @param string $targetUrlPattern
* @param string $targetUrlPattern
* @return $this
*/
public function setTargetUrlPattern($targetUrlPattern)
Expand Down Expand Up @@ -116,7 +116,7 @@ public function notify(Commit $commit)
}

/**
* @param Commit $commit
* @param Commit $commit
* @return string
*/
protected function getStatusEndpointUrl(Commit $commit)
Expand All @@ -125,7 +125,7 @@ protected function getStatusEndpointUrl(Commit $commit)
}

/**
* @param Commit $commit
* @param Commit $commit
* @return string
*/
protected function getGitHubState(Commit $commit)
Expand Down Expand Up @@ -156,7 +156,7 @@ protected function getGitHubHeaders()
/**
* @param $url
* @param $data
* @param array $headers
* @param array $headers
* @return bool
*/
protected function request($url, $data, array $headers = array())
Expand Down

0 comments on commit 558479d

Please sign in to comment.