Showing 18 of 198 total issues
Method loadKubeConfigFromArray
has 78 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function loadKubeConfigFromArray(array $kubeconfig, string $context = null)
{
/** @var \RenokiCo\PhpK8s\KubernetesCluster $this */
// Compute the context from the method, or in case it is passed as null
Function loadKubeConfigFromArray
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
protected function loadKubeConfigFromArray(array $kubeconfig, string $context = null)
{
/** @var \RenokiCo\PhpK8s\KubernetesCluster $this */
// Compute the context from the method, or in case it is passed as 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"
Further reading
Method makeWsRequest
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function makeWsRequest(string $path, Closure $callback = null, array $query = ['pretty' => 1])
{
$url = $this->getCallableUrl($path, $query);
// Replace the HTTP protocol prefixes with WS protocols.
Method getWsClient
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getWsClient(string $url): array
{
$options = [
'timeout' => 20,
'tls' => [],
Method buildStreamContextOptions
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function buildStreamContextOptions(): array
{
$sslOptions = $headers = [];
if (is_bool($this->verify)) {
Function fromKubeConfigVariable
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public static function fromKubeConfigVariable(string $context = null)
{
/** @var \RenokiCo\PhpK8s\KubernetesCluster $this */
$cluster = new static;
- 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 __call
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function __call($method, $parameters)
{
// Proxy the ->get[Resource]ByName($name, $namespace = 'default')
// For example, ->getConfigMapByName('settings')
if (preg_match('/get(.+)ByName/', $method, $matches)) {
- 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 buildStreamContextOptions
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
protected function buildStreamContextOptions(): array
{
$sslOptions = $headers = [];
if (is_bool($this->verify)) {
- 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 addLabelSelectorRequirement
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function addLabelSelectorRequirement(array $expressions, array $fieldsExpressions, string $topologyKey)
{
foreach ($expressions as &$expression) {
if ($expression instanceof Expression) {
$expression = $expression->toArray();
- 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 addNodeSelectorPreference
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function addNodeSelectorPreference(array $expressions, array $fieldsExpressions, int $weight = 1)
{
foreach ($expressions as &$expression) {
if ($expression instanceof Expression) {
$expression = $expression->toArray();
- 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 addNodeRequirement
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function addNodeRequirement(array $expressions, array $fieldsExpressions)
{
foreach ($expressions as &$expression) {
if ($expression instanceof Expression) {
$expression = $expression->toArray();
- 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 addPreference
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function addPreference(array $expressions, array $fieldsExpressions, int $weight = 1)
{
foreach ($expressions as &$expression) {
if ($expression instanceof Expression) {
$expression = $expression->toArray();
- 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
Avoid too many return
statements within this method. Open
return $this;
Avoid too many return
statements within this method. Open
return $this->makeRequest($method, $path, $payload, $query);
Function getClient
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function getClient()
{
$options = [
RequestOptions::HEADERS => [
'Content-Type' => 'application/json',
- 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 getWsClient
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function getWsClient(string $url): array
{
$options = [
'timeout' => 20,
'tls' => [],
- 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 runOperation
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function runOperation(string $operation, string $path, $payload = '', array $query = ['pretty' => 1])
{
switch ($operation) {
case static::WATCH_OP: return $this->watchPath($path, $payload, $query);
break;
- 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 makeWsRequest
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function makeWsRequest(string $path, Closure $callback = null, array $query = ['pretty' => 1])
{
$url = $this->getCallableUrl($path, $query);
// Replace the HTTP protocol prefixes with WS protocols.
- 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"