bexiocom/prometheus_php

View on GitHub

Showing 10 of 22 total issues

Method collectSingleSamples has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function collectSingleSamples(MetricType $metric)
    {
        $options = $metric->getOptions();
        $buckets = $options instanceof HistogramOptions
            ? array_merge($options->getBuckets(), array('+Inf'))
Severity: Minor
Found in src/Storage/ArrayStorage.php - About 1 hr to fix

    Method createFromValues has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

            $name,
            $help,
            array $labelNames,
            array $buckets,
            $namespace = null,
    Severity: Major
    Found in src/Metric/HistogramCollection.php - About 50 mins to fix

      Method createFromValues has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

              $name,
              $help,
              array $labelNames,
              $namespace = null,
              $subsystem = null,
      Severity: Minor
      Found in src/Metric/CounterCollection.php - About 45 mins to fix

        Function getLabelsKey has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function getLabelsKey(MetricType $metric, $value = null)
            {
                $options = $metric->getOptions();
                $labels = $options->getLabels();
                if ($options instanceof HistogramOptions && null !== $value) {
        Severity: Minor
        Found in src/Storage/ArrayStorage.php - About 45 mins to fix

        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 createFromValues has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

                $name,
                $help,
                array $buckets = null,
                $namespace = null,
                $subsystem = null,
        Severity: Minor
        Found in src/Metric/Histogram.php - About 45 mins to fix

          Method createFromValues has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                  $name,
                  $help,
                  array $labelNames,
                  $namespace = null,
                  $subsystem = null,
          Severity: Minor
          Found in src/Metric/GaugeCollection.php - About 45 mins to fix

            Method __construct has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                    $name,
                    $help,
                    array $buckets = null,
                    $namespace = null,
                    $subsystem = null,
            Severity: Minor
            Found in src/Metric/HistogramOptions.php - About 45 mins to fix

              Method __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  public function __construct($name, $help, $namespace = null, $subsystem = null, array $constantLabels = array())
              Severity: Minor
              Found in src/Options.php - About 35 mins to fix

                Method createFromValues has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    public static function createFromValues($name, $help, $namespace = null, $subsystem = null, array $labels = array())
                Severity: Minor
                Found in src/Metric/Gauge.php - About 35 mins to fix

                  Method createFromValues has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      public static function createFromValues($name, $help, $namespace = null, $subsystem = null, array $labels = array())
                  Severity: Minor
                  Found in src/Metric/Counter.php - About 35 mins to fix
                    Severity
                    Category
                    Status
                    Source
                    Language