Showing 60 of 103 total issues
Function convertDataToItems
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function convertDataToItems($data, $key, $conversions = [], $limit = 15)
{
if (!isset($conversions['unknown'])) {
$conversions['unknown'] = 0;
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function sortable
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
function sortable($label, $field)
{
$query = request()->query();
$newQuery = $query;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function moduleLinks
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function moduleLinks($ignoredModules = [], $linkClass = 'nav-link', $listClass = 'nav-item')
{
$links = '';
$modules = config('cms.modules', []);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method handle
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function handle()
{
$moduleDir = base_path(config('cms.module-directory')).'/'.ucfirst($this->argument('module'));
if (is_dir($moduleDir)) {
$readMeStub = file_get_contents(__DIR__.'/../Templates/Composer/readme.stub');
Method handle
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function handle()
{
$name = $this->argument('name');
$fileSystem = new Filesystem();
Function check
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function check($form, $jsonInput = false)
{
$result = [];
$errors = [];
$inputs = [];
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function promotion
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function promotion($slug)
{
$promotion = app(PromotionRepository::class)->getBySlug($slug);
if ($promotion) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method preview
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function preview($entity, $id)
{
$modelString = 'Grafite\Cms\Models\\'.ucfirst($entity);
if (!class_exists($modelString)) {
Method asPreview
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function asPreview($encFileName, Filesystem $fileSystem)
{
try {
return Cache::remember($encFileName.'_preview', 3600, function () use ($encFileName, $fileSystem) {
$fileName = CryptoServiceFacade::url_decode($encFileName);
Method register
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function register()
{
$loader = AliasLoader::getInstance();
$loader->alias('Cms', \Grafite\Cms\Facades\CmsServiceFacade::class);
Function asset
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function asset($encPath, $contentType, Filesystem $fileSystem)
{
try {
$path = CryptoServiceFacade::url_decode($encPath);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function saveFile
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function saveFile($fileName, $directory = '', $fileTypes = [], $isImage = false)
{
if (is_object($fileName)) {
$file = $fileName;
$originalName = $file->getClientOriginalName();
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function handle
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function handle()
{
$name = $this->argument('name');
$fileSystem = new Filesystem();
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function allTags
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function allTags()
{
$tags = [];
if (app()->getLocale() !== config('cms.default-language', 'en')) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function main
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function main()
{
if (!is_null(config('analytics.view_id')) && config('cms.analytics') == 'google') {
$period = Period::days(7);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function inputsArray
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function inputsArray($jsonInput)
{
if ($jsonInput) {
$inputs = Input::json();
} else {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function update
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function update($image, $input)
{
if (isset($input['location']) && !empty($input['location'])) {
$savedFile = app(FileService::class)->saveFile($input['location'], 'public/images', [], true);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function widget
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function widget($slug)
{
$widget = app(WidgetRepository::class)->getBySlug($slug);
if ($widget) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function store
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function store(Request $request)
{
try {
$validation = app(ValidationService::class)->check(['location' => 'required']);
if (!$validation['errors']) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function collectSiteMapItems
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function collectSiteMapItems()
{
$itemCollection = [];
$modules = config('site-mapped-modules', [
'blog' => 'Grafite\Cms\Repositories\BlogRepository',
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"