mirror of
https://github.com/flarum/framework.git
synced 2024-12-01 14:20:47 +08:00
PSR-2 fixes
This commit is contained in:
parent
b792fd2efd
commit
01ec661c3f
|
@ -163,7 +163,8 @@ class ApiServiceProvider extends ServiceProvider
|
||||||
$routes->post(
|
$routes->post(
|
||||||
'/discussions',
|
'/discussions',
|
||||||
'flarum.api.discussions.create',
|
'flarum.api.discussions.create',
|
||||||
$this->action('Flarum\Api\Actions\Discussions\CreateAction'));
|
$this->action('Flarum\Api\Actions\Discussions\CreateAction')
|
||||||
|
);
|
||||||
|
|
||||||
// Show a single discussion
|
// Show a single discussion
|
||||||
$routes->get(
|
$routes->get(
|
||||||
|
|
|
@ -4,6 +4,10 @@ use Flarum\Api\AccessToken;
|
||||||
|
|
||||||
class GenerateAccessTokenHandler
|
class GenerateAccessTokenHandler
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @param GenerateAccessToken $command
|
||||||
|
* @return AccessToken
|
||||||
|
*/
|
||||||
public function handle(GenerateAccessToken $command)
|
public function handle(GenerateAccessToken $command)
|
||||||
{
|
{
|
||||||
$token = AccessToken::generate($command->userId);
|
$token = AccessToken::generate($command->userId);
|
||||||
|
|
|
@ -36,9 +36,7 @@ class RevisionCompiler implements Compiler
|
||||||
$ext = pathinfo($this->filename, PATHINFO_EXTENSION);
|
$ext = pathinfo($this->filename, PATHINFO_EXTENSION);
|
||||||
$file = $this->path.'/'.substr_replace($this->filename, '-'.$revision, -strlen($ext) - 1, 0);
|
$file = $this->path.'/'.substr_replace($this->filename, '-'.$revision, -strlen($ext) - 1, 0);
|
||||||
|
|
||||||
if (! ($exists = file_exists($file))
|
if (! ($exists = file_exists($file)) || filemtime($file) < $lastModTime) {
|
||||||
|| filemtime($file) < $lastModTime) {
|
|
||||||
|
|
||||||
if ($exists) {
|
if ($exists) {
|
||||||
unlink($file);
|
unlink($file);
|
||||||
}
|
}
|
||||||
|
|
|
@ -112,8 +112,7 @@ class GenerateExtensionCommand extends Command
|
||||||
if ($file != '.' && $file != '..') {
|
if ($file != '.' && $file != '..') {
|
||||||
if (is_dir($src.'/'.$file)) {
|
if (is_dir($src.'/'.$file)) {
|
||||||
$this->recursiveCopy($src.'/'.$file, $dst.'/'.$file, $replacements);
|
$this->recursiveCopy($src.'/'.$file, $dst.'/'.$file, $replacements);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$contents = file_get_contents($src.'/'.$file);
|
$contents = file_get_contents($src.'/'.$file);
|
||||||
$contents = str_replace(array_keys($replacements), array_values($replacements), $contents);
|
$contents = str_replace(array_keys($replacements), array_values($replacements), $contents);
|
||||||
|
|
||||||
|
|
|
@ -161,8 +161,7 @@ class Application extends Container implements LaravelApplication
|
||||||
*/
|
*/
|
||||||
protected function fireListeners(array $listeners)
|
protected function fireListeners(array $listeners)
|
||||||
{
|
{
|
||||||
foreach ($listeners as $listener)
|
foreach ($listeners as $listener) {
|
||||||
{
|
|
||||||
$listener($this);
|
$listener($this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@ abstract class Action
|
||||||
*/
|
*/
|
||||||
protected function redirectTo($url)
|
protected function redirectTo($url)
|
||||||
{
|
{
|
||||||
$content = sprintf(<<<'HTML'
|
$content = sprintf('
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
|
@ -39,9 +39,7 @@ abstract class Action
|
||||||
<body>
|
<body>
|
||||||
Redirecting to <a href="%1$s">%1$s</a>.
|
Redirecting to <a href="%1$s">%1$s</a>.
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>', htmlspecialchars($url, ENT_QUOTES, 'UTF-8'));
|
||||||
HTML
|
|
||||||
, htmlspecialchars($url, ENT_QUOTES, 'UTF-8'));
|
|
||||||
|
|
||||||
$response = new RedirectResponse($url);
|
$response = new RedirectResponse($url);
|
||||||
$response->getBody()->write($content);
|
$response->getBody()->write($content);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user