Skip to content

Commit f7c3eb2

Browse files
committed
Some minor linting fixes
1 parent b59dd32 commit f7c3eb2

File tree

5 files changed

+127
-116
lines changed

5 files changed

+127
-116
lines changed

libs/csrf/LoggerInterface.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
* This file has implementation for LoggerInterface interface
44
*/
55

6-
if (!defined('__CSRF_PROTECTOR_loggerInterface__')) {
6+
if (!defined('__CSRF_PROTECTOR_LOGGER_INTERFACE__')) {
77
// to avoid multiple declaration errors
8-
define('__CSRF_PROTECTOR_loggerInterface__', true);
8+
define('__CSRF_PROTECTOR_LOGGER_INTERFACE__', true);
99

1010
/**
1111
* Interface for logger class

libs/csrf/csrfpAction.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
<?php
22
/**
3-
* This file has implementation for csrfpAction class
3+
* This file has implementation for csrfpAction class.
44
*/
55

6-
if (!defined('__CSRF_PROTECTOR_csrfpAction__')) {
6+
if (!defined('__CSRF_PROTECTOR_ACTION__')) {
77
// to avoid multiple declaration errors
8-
define('__CSRF_PROTECTOR_csrfpAction__', true);
8+
define('__CSRF_PROTECTOR_ACTION__', true);
99

1010
/**
11-
* Enumerator for actions
11+
* Enumerator for actions.
1212
*/
1313
abstract class csrfpAction {
1414
/**

libs/csrf/csrfpCookieConfig.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
<?php
22
/**
3-
* This file has implementation for csrfpCookieConfig class
3+
* This file has implementation for csrfpCookieConfig class.
44
*/
55

6-
if (!defined('__CSRF_PROTECTOR_csrfpCookieConfig__')) {
7-
// to avoid multiple declaration errors
8-
define('__CSRF_PROTECTOR_csrfpCookieConfig__', true);
6+
if (!defined('__CSRF_PROTECTOR_COOKIE_CONFIG__')) {
7+
// to avoid multiple declaration errors.
8+
define('__CSRF_PROTECTOR_COOKIE_CONFIG__', true);
99

1010
/**
11-
* Cookie config class
11+
* Cookie configuration class.
1212
*/
1313
class csrfpCookieConfig
1414
{

libs/csrf/csrfpDefaultLogger.php

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,23 @@
11
<?php
22
/**
3-
* This file has implementation for csrfpDefaultLogger class
3+
* This file has implementation for csrfpDefaultLogger class.
44
*/
55
include __DIR__ ."/LoggerInterface.php";
66

7-
if (!defined('__CSRF_PROTECTOR_csrfpDefaultLogger_')) {
7+
if (!defined('__CSRF_PROTECTOR_DEFAULT_LOGGER_')) {
88
// to avoid multiple declaration errors
9-
define('__CSRF_PROTECTOR_csrfpDefaultLogger_', true);
9+
define('__CSRF_PROTECTOR_DEFAULT_LOGGER_', true);
1010

1111
class logDirectoryNotFoundException extends \exception {};
1212
class logFileWriteError extends \exception {};
1313

1414
/**
15-
* Default logger class for CSRF Protector
16-
* This is a file based logger class
15+
* Default logger class for CSRF Protector.
16+
*
17+
* This is a file based logger class.
1718
*/
1819
class csrfpDefaultLogger implements LoggerInterface {
20+
1921
/**
2022
* Variable: $logDirectory
2123
* directory for file based logging
@@ -35,12 +37,11 @@ class csrfpDefaultLogger implements LoggerInterface {
3537
* logDirectoryNotFoundException - if log directory is not found
3638
*/
3739
function __construct($path) {
38-
//// Check for relative path
40+
// Check for relative path
3941
$this->logDirectory = __DIR__ . "/../" . $path;
4042

4143

42-
//// If the relative log directory path does not
43-
//// exist try as an absolute path
44+
// If the relative log directory path does not exist try as an absolute path.
4445
if (!is_dir($this->logDirectory)) {
4546
$this->logDirectory = $path;
4647
}
@@ -67,21 +68,21 @@ public function log($message, $context = array()) {
6768
// Append to the log file, or create it if it does not exist create
6869
$logFile = fopen($this->logDirectory ."/" . date("m-20y") . ".log", "a+");
6970

70-
//throw exception if above fopen fails
71+
// Throw exception if above fopen fails
7172
if (!$logFile) {
7273
throw new logFileWriteError("OWASP CSRFProtector: Unable to write to the log file");
7374
}
7475

7576
$context['timestamp'] = time();
7677
$context['message'] = $message;
7778

78-
//convert log array to JSON format to be logged
79+
// Convert log array to JSON format to be logged
7980
$context = json_encode($context) .PHP_EOL;
8081

81-
//append log to the file
82+
// Append log to the file
8283
fwrite($logFile, $context);
8384

84-
//close the file handler
85+
// Close the file handler
8586
fclose($logFile);
8687
}
8788
}

0 commit comments

Comments
 (0)