Skip to content

Commit

Permalink
Prefer single quotes
Browse files Browse the repository at this point in the history
  • Loading branch information
Wenzel Pünter committed Oct 23, 2014
1 parent 3c23184 commit 3a7d3a1
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/Isbn/CheckDigit.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public function make10($isbn)
//Calculate check digit
$check = 0;
for ($i = 0; $i < 9; $i++) {
if ($isbn[$i] === "X") {
if ($isbn[$i] === 'X') {
$check += 10 * intval(10 - $i);
} else {
$check += intval($isbn[$i]) * intval(10 - $i);
Expand Down
10 changes: 5 additions & 5 deletions src/Isbn/Hyphens.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ public function removeHyphens($isbn)
throw new Exception('Invalid parameter type.');
}

$isbn = str_replace(" ", "", $isbn);
$isbn = str_replace("-", "", $isbn);
$isbn = str_replace(' ', '', $isbn);
$isbn = str_replace('-', '', $isbn);
return $isbn;
}

Expand All @@ -54,7 +54,7 @@ public function removeHyphens($isbn)
* @param string $char
* @return string
*/
public function fixHyphens($isbn, $char = "-")
public function fixHyphens($isbn, $char = '-')
{
$isbn = $this->removeHyphens($isbn);
return $this->addHyphens($isbn, $char);
Expand All @@ -67,7 +67,7 @@ public function fixHyphens($isbn, $char = "-")
* @param string $char
* @throws Exception
*/
public function addHyphens($isbn, $char = "-")
public function addHyphens($isbn, $char = '-')
{
if(is_string($isbn) === false ||
is_string($char) === false) {
Expand Down Expand Up @@ -168,7 +168,7 @@ private function getRegistrantElement()
if (isset($this->isbnSplit[0]) === true) {
$soFar = implode('-', $this->isbnSplit);
} else {
$soFar = "978-".$this->isbnSplit[1];
$soFar = '978-'.$this->isbnSplit[1];
}

switch ($soFar) {
Expand Down
4 changes: 2 additions & 2 deletions src/Isbn/Translate.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ public function to13($isbn)
$isbn = substr($isbn, 0, -1);

if (strlen($isbn) > 9) {
$isbn = "978-".$isbn;
$isbn = '978-'.$isbn;
} else {
$isbn = "978".$isbn;
$isbn = '978'.$isbn;
}

return $isbn.$this->checkDigit->make($isbn);
Expand Down
6 changes: 3 additions & 3 deletions src/Isbn/Validation.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,14 @@ public function isbn10($isbn)
if (strlen($isbn) != 10) {
return false;
}
if (preg_match("/\d{9}[0-9xX]/i",$isbn) == false) {
if (preg_match('/\d{9}[0-9xX]/i',$isbn) == false) {
return false;
}

//Verify checksum
$check = 0;
for ($i = 0; $i < 10; $i++) {
if ($isbn[$i] === "X") {
if ($isbn[$i] === 'X') {
$check += 10 * intval(10 - $i);
} else {
$check += intval($isbn[$i]) * intval(10 - $i);
Expand All @@ -108,7 +108,7 @@ public function isbn13($isbn)
if (strlen($isbn) != 13) {
return false;
}
if (preg_match("/\d{13}/i",$isbn) == false) {
if (preg_match('/\d{13}/i',$isbn) == false) {
return false;
}

Expand Down

0 comments on commit 3a7d3a1

Please sign in to comment.