Showing 15 of 15 total issues
Method show
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function show(string $productKey, string $version, string $page = null)
{
// ensure product exists
$product = $this->productFinder->findProduct($productKey);
if ($product === null) {
Method registerBindings
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function registerBindings(): self
{
$this->app->singleton(FilesystemContract::class, Filesystem::class);
$this->app->singleton(DocumentationPublisherContract::class, DocumentationPublisher::class);
$this->app->singleton(DocumentationProviderContract::class, DocumentationProvider::class);
Method publish
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function publish(Product $product, string $source): Result
{
$result = new Result();
$versions = [Product::VERSION_MAIN];
$versionsPublished = [];
Function initSidebar
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
initSidebar() {
let _self = this,
$sidebar = this.$wrapper.find('.docweaver-sidebar'),
$sidebarPopper = $sidebar.find('.docweaver-sidebar-popper'),
$activeLink = $sidebar.find('li a[href="' + decodeURIComponent(window.location.pathname) + '"]');
Method update
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function update(Product $product): Result
{
$result = new Result();
$publishedVersions = array_keys($product->getVersions());
$availableTags = $this->listAvailableProductTags($product);
Function getDefaultVersion
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function getDefaultVersion(bool $allowWordedDefault = false): string
{
$versions = empty($this->versions) ? $this->getVersions() : $this->versions;
$allowWordedDefault = $allowWordedDefault || $this->configProvider->isWordedDefaultVersionAllowed();
$defaultVersion = self::VERSION_UNKNOWN;
- 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 initBlockquotes
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
initBlockquotes() {
// It's nice to just write in Markdown, so this will adjust
// our blockquote style to fill in the icon flag and label
this.$wrapper.find('.docs blockquote p:first-child').each(function () {
let str = $(this).html(),
Method __construct
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
string $masterTemplate,
string $masterSection,
string $styleStack,
string $scriptStack,
string $indexTitle,
Method __construct
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Filesystem $filesystem,
Logger $logger,
ConfigProvider $configProvider,
ProductPublisher $productPublisher,
ProductFactory $productFactory
Method __construct
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Filesystem $filesystem,
ConfigProvider $configProvider,
FileHelper $fileHelper,
YamlHelper $yamlHelper,
string $directory
Method createProcess
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
array $command,
string $cwd = null,
array $env = null,
$input = null,
?float $timeout = 60
Method createProcess
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
array $command,
string $cwd = null,
array $env = null,
$input = null,
?float $timeout = 60
Function tell
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function tell($text, $direction = self::TELL_DIRECTION_OUT): string
{
$direction = strtolower($direction);
$nl = app()->runningInConsole() ? "\n" : '<br/>';
$dirSymbol = ($direction === self::TELL_DIRECTION_IN
- 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 listProducts
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function listProducts(bool $includeUnknowns = false): array
{
$products = [];
$documentationDirectory = $this->configProvider->getDocumentationDirectory();
$productDirectories = $this->filesystem->directories(base_path($documentationDirectory));
- 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 show
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function show(string $productKey, string $version, string $page = null)
{
// ensure product exists
$product = $this->productFinder->findProduct($productKey);
if ($product === null) {
- 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"