Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

Commit

Permalink
Refactor usage of exit to using return
Browse files Browse the repository at this point in the history
  • Loading branch information
white-gecko committed May 26, 2016
1 parent 5a242f1 commit b35e2cb
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
12 changes: 8 additions & 4 deletions application/shell.worker.client.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ function initApp()
header('HTTP/1.1 500 Internal Server Error');
echo 'Fatal Error: Could not load Zend library.<br />' . PHP_EOL
. 'Maybe you need to install it with apt-get or with "make zend"?' . PHP_EOL;
exit;
return false;
}

// create application
Expand All @@ -135,7 +135,7 @@ function initApp()
} catch (Exception $e) {
echo 'Fatal Error: Could not load the OntoWiki Application Framework classes.' . PHP_EOL;
echo 'Your installation directory seems to be screwed.' . PHP_EOL;
exit;
return false;
}

/* check/include Erfurt_App */
Expand All @@ -145,7 +145,7 @@ function initApp()
} catch (Exception $e) {
echo 'Fatal Error: Could not load the Erfurt Framework classes.' . PHP_EOL;
echo 'Maybe you should install it with apt-get or with "make deploy"?' . PHP_EOL;
exit;
return false;
}

// restore old error handler
Expand All @@ -156,12 +156,16 @@ function initApp()
$application->bootstrap();
} catch (Exception $e) {
echo 'Error on bootstrapping application: ' . $e->getMessage() . PHP_EOL;
exit;
return false;
}
return $application;
}

$application = initApp();
if ($application === false) {
return 1;
}

$ontowiki = OntoWiki::getInstance();
echo $ontowiki->config->version->label . ' ' . $ontowiki->config->version->number . PHP_EOL;

Expand Down
13 changes: 8 additions & 5 deletions application/shell.worker.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ function initApp()
header('HTTP/1.1 500 Internal Server Error');
echo 'Fatal Error: Could not load Zend library.<br />' . PHP_EOL
. 'Maybe you need to install it with apt-get or with "make zend"?' . PHP_EOL;
exit;
return false;
}

// create application
Expand All @@ -130,7 +130,7 @@ function initApp()
} catch (Exception $e) {
echo 'Fatal Error: Could not load the OntoWiki Application Framework classes.' . PHP_EOL;
echo 'Your installation directory seems to be screwed.' . PHP_EOL;
exit;
return false;
}

/* check/include Erfurt_App */
Expand All @@ -140,7 +140,7 @@ function initApp()
} catch (Exception $e) {
echo 'Fatal Error: Could not load the Erfurt Framework classes.' . PHP_EOL;
echo 'Maybe you should install it with apt-get or with "make deploy"?' . PHP_EOL;
exit;
return false;
}

// restore old error handler
Expand All @@ -151,12 +151,15 @@ function initApp()
$application->bootstrap();
} catch (Exception $e) {
echo 'Error on bootstrapping application: ' . $e->getMessage() . PHP_EOL;
exit;
return false;
}
return $application;
}

$application = initApp();
if ($application === false) {
return 1;
}

$bootstrap = $application->getBootstrap();
$ontoWiki = OntoWiki::getInstance();
Expand All @@ -175,7 +178,7 @@ function initApp()
$event->trigger();
if (!count($workerRegistry->getJobs())) {
echo 'No jobs registered - nothing to do or wait for.' . PHP_EOL;
exit;
return;
}

// register jobs manually
Expand Down

0 comments on commit b35e2cb

Please sign in to comment.