Skip to content

Commit

Permalink
Merge pull request #14 from PrisisForks/master
Browse files Browse the repository at this point in the history
Convert tabs to spaces
  • Loading branch information
paragonie-scott authored Aug 3, 2016
2 parents 8d73971 + 0fc151d commit 3ef8c5a
Showing 1 changed file with 29 additions and 29 deletions.
58 changes: 29 additions & 29 deletions src/AntiCSRF.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,15 @@ class AntiCSRF
protected $recycle_after = 65535;
protected $hmac_ip = true;
protected $expire_old = false;

// Injected; defaults to references to superglobals
public $post;
public $session;
public $server;

/**
* NULL is not a valid array type
*
*
* @param array $post
* @param array $session
* @param array $server
Expand All @@ -83,7 +83,7 @@ public function __construct(
} else {
$this->post =& $_POST;
}

if ($server !== null) {
$this->server =& $server;
} else {
Expand All @@ -106,24 +106,24 @@ public function __construct(
*/
public function insertToken(string $lockTo = '', bool $echo = true): string
{
$token_array = $this->getTokenArray($lockTo);
$ret = \implode(
\array_map(
function($key, $value) {
return "<!--\n-->".
"<input type=\"hidden\"" .
" name=\"".$key."\"" .
" value=\"".self::noHTML($value)."\"" .
" />";
},
\array_keys($token_array),
$token_array
$token_array = $this->getTokenArray($lockTo);
$ret = \implode(
\array_map(
function($key, $value) {
return "<!--\n-->".
"<input type=\"hidden\"" .
" name=\"".$key."\"" .
" value=\"".self::noHTML($value)."\"" .
" />";
},
\array_keys($token_array),
$token_array
)
);
if ($echo) {
echo $ret;
return null;
}
if ($echo) {
echo $ret;
return null;
}
return $ret;
}

Expand Down Expand Up @@ -151,14 +151,14 @@ public function getFormToken(): string
return $this->formToken;
}

/**
* Retrieve a token array for unit testing endpoints
*
/**
* Retrieve a token array for unit testing endpoints
*
* @param string $lockTo
* @return array
*/
public function getTokenArray(string $lockTo = ''): array
{
* @return array
*/
public function getTokenArray(string $lockTo = ''): array
{
if (!isset($this->session[$this->sessionIndex])) {
$this->session[$this->sessionIndex] = [];
}
Expand Down Expand Up @@ -190,9 +190,9 @@ public function getTokenArray(string $lockTo = ''): array
}

return [
$this->formIndex => $index,
$this->formToken => $token,
];
$this->formIndex => $index,
$this->formToken => $token,
];
}

/**
Expand Down

0 comments on commit 3ef8c5a

Please sign in to comment.