Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Laravel Consolidate Namespaces Shift #166

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions app/Console/Commands/GenerateSiteMap.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace App\Console\Commands;

use Carbon\Carbon;
use Illuminate\Console\Command;
use Illuminate\Support\Str;
use Carbon\Carbon;
use Spatie\Sitemap\Sitemap;
use Spatie\Sitemap\Tags\Url;

Expand Down Expand Up @@ -48,7 +48,6 @@ public function handle()
$sitemap->add($url);
});


$sitemap->writeToDisk($disk, 'sitemap.xml');

return 0;
Expand Down
2 changes: 1 addition & 1 deletion app/Console/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ protected function schedule(Schedule $schedule)
*/
protected function commands()
{
$this->load(__DIR__ . '/Commands');
$this->load(__DIR__.'/Commands');

require base_path('routes/console.php');
}
Expand Down
21 changes: 10 additions & 11 deletions app/Docs.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ class Docs
protected $path;

/**
* @param string $locale
* @param string $path
* @param string $locale
* @param string $path
*/
public function __construct(string $locale, string $path)
{
Expand All @@ -32,9 +32,9 @@ public function __construct(string $locale, string $path)
}

/**
* @param string $view
*
* @param string $view
* @return \Illuminate\Contracts\View\View
*
* @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
*/
public function view(string $view)
Expand All @@ -47,7 +47,7 @@ public function view(string $view)

$all = collect()->merge($variables)->merge([
'content' => Str::of($page)->after('---')->after('---')->markdown(),
'edit' => $this->editLinkGitHub(),
'edit' => $this->editLinkGitHub(),
]);

return view($view, $all);
Expand All @@ -62,24 +62,23 @@ protected function editLinkGitHub()
}

/**
* @param string $locale
*
* @param string $locale
* @return string
*/
public static function ahref(string $locale)
{
$pattern = "/$locale/";

$url = str_ireplace([
config('app.url') . '/ru',
config('app.url') . '/en',
config('app.url').'/ru',
config('app.url').'/en',
], $pattern, URL::current());

if (!Str::contains($url, $pattern)) {
if (! Str::contains($url, $pattern)) {
$url .= $pattern;
}

$url = config('app.url') . str_replace('//', '/', parse_url($url, PHP_URL_PATH));
$url = config('app.url').str_replace('//', '/', parse_url($url, PHP_URL_PATH));

return Str::finish($url, '/');
}
Expand Down
2 changes: 1 addition & 1 deletion app/View/Components/Backers.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function render()
});

return view('components.backers', [
'backers' => $backers
'backers' => $backers,
]);
}
}
12 changes: 5 additions & 7 deletions app/View/Components/DocsAnchors.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public function __construct(string $content)
* Get the view / contents that represent the component.
*
* @return \Illuminate\Contracts\View\View|\Closure|string
*
* @throws \DOMException
*/
public function render()
Expand All @@ -36,11 +37,10 @@ public function render()
]);
}


/**
* @param $contents
*
* @return array
*
* @throws \DOMException
*/
private function findAnchors()
Expand All @@ -59,20 +59,18 @@ private function findAnchors()
$text = $node->textContent;
$id = Str::slug($text);
$anchors[] = [
'text' => $text,
'text' => $text,
'level' => $node->tagName,
'id' => $id,
'id' => $id,
];
while ($node->hasChildNodes()) {
$node->removeChild($node->firstChild);
}
$node->appendChild(new \DOMElement('a', $text));
$node->firstChild->setAttribute('href', '#' . $id);
$node->firstChild->setAttribute('href', '#'.$id);
$node->firstChild->setAttribute('name', $id);
});


return $anchors;
}

}
7 changes: 3 additions & 4 deletions app/View/Components/DocsContent.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public function __construct(string $content)
* Get the view / contents that represent the component.
*
* @return \App\View\Components\DocsContent
*
* @throws \DOMException
*/
public function render()
Expand All @@ -38,8 +39,8 @@ public function render()

/**
* @param $contents
*
* @return string
*
* @throws \DOMException
*/
private function detectAnchors()
Expand Down Expand Up @@ -76,21 +77,19 @@ private function detectAnchors()
$crawler
->filter('p,li')
->each(function (Crawler $elm) use ($fixer) {

$content = $elm->html();

$paragraph = $fixer->fix($content);

$this->content = Str::of($this->content)->replace($content, $paragraph);
});


return $this->content;
}


/**
* @return string
*
* @throws \DOMException
*/
public function toHtml(): string
Expand Down
5 changes: 2 additions & 3 deletions app/View/Components/DocsMenu.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@

namespace App\View\Components;


use Illuminate\Contracts\Foundation\Application;
use Illuminate\Config\Repository;
use Illuminate\Contracts\Foundation\Application;
use Illuminate\View\Component;

class DocsMenu extends Component
Expand Down Expand Up @@ -34,7 +33,7 @@ public function __construct(Application $application, Repository $config)
public function render()
{
return view('components.docs-menu', [
'menu' => $this->menu
'menu' => $this->menu,
]);
}
}
8 changes: 4 additions & 4 deletions config/cagilo.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
*/

'components' => [
'alert' => Components\Alert::class,
'alert' => Components\Alert::class,
'device' => Components\Device::class,
'error' => Components\Error::class,
'icon' => Components\Icon::class,
'error' => Components\Error::class,
'icon' => Components\Icon::class,
'logout' => Components\Logout::class,
'meta' => Components\Meta::class,
'meta' => Components\Meta::class,
'submit' => Components\Submit::class,
],

Expand Down
4 changes: 2 additions & 2 deletions config/export.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/
'paths' => [
'/en',
'/ru'
'/ru',
],

/*
Expand Down Expand Up @@ -69,7 +69,7 @@
* You can skip these by adding a `--skip-{name}` flag to the command.
*/
'after' => [
'sitemap' => 'php artisan make:sitemap',
'sitemap' => 'php artisan make:sitemap',
],

];
5 changes: 2 additions & 3 deletions config/services.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
],


'github' => [
'token' => env('GITHUB_TOKEN')
]
'token' => env('GITHUB_TOKEN'),
],
];
Loading