Skip to content

Commit 9769bce

Browse files
committed
Merge pull request Alexia#3 from AngryDeveloper/fix_notices
Fixed some PHP notices thrown at runtime
2 parents 37f942a + 3e8ee2c commit 9769bce

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

classes/options.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,10 @@ private function enforceOptions() {
225225
* @return mixed
226226
*/
227227
public function getOption($option) {
228+
if (!array_key_exists($option, $this->options)){
229+
return false;
230+
}
228231
return $this->options[$option];
229232
}
230233
}
231-
?>
234+
?>

mar.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class main {
5555
public function __construct() {
5656
define('PHP7MAR_DIR', __DIR__);
5757
define('PHP7MAR_VERSION', '0.0.1');
58-
spl_autoload_register([self, 'autoloader'], true, false);
58+
spl_autoload_register([$this, 'autoloader'], true, false);
5959

6060
//Setup command line options/switches.
6161
$this->options = new options();
@@ -97,8 +97,10 @@ public function __construct() {
9797
*/
9898
private function run() {
9999
$issues = [];
100+
$totalFiles = 0;
101+
$totalLines = 0;
100102
$filePath = $this->scanner->getCurrentFilePath();
101-
if (!$this->options->getOption('t') || in_array('syntax', $this->options->getOption('t'))) {
103+
if (!$this->options->getOption('t') || in_array('syntax', $this->options->getOption('t'), true)) {
102104
$checkSyntax = true;
103105
} else {
104106
$checkSyntax = false;
@@ -155,7 +157,7 @@ static public function autoloader($className) {
155157
if (is_file($file)) {
156158
require_once($file);
157159
} else {
158-
throw new \Exception(__CLASS__.": Class file for {$classname} not found at {$file}.");
160+
throw new \Exception(__CLASS__.": Class file for {$className} not found at {$file}.");
159161
}
160162
}
161163

@@ -179,4 +181,4 @@ static public function getRealPath($path) {
179181
}
180182
}
181183
$mar = new \mar\main();
182-
?>
184+
?>

0 commit comments

Comments
 (0)