WaitsForMySQLDatabase   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
dl 0
loc 18
rs 10
c 0
b 0
f 0
wmc 2
lcom 1
cbo 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A waitForMySQLDatabaseByName() 0 8 2
1
<?php
2
3
namespace Acacha\ForgePublish\Commands\Traits;
4
5
/**
6
 * Class WaitsForMySQLDatabase.
7
 *
8
 * @package Acacha\ForgePublish\Commands\Traits
9
 */
10
trait WaitsForMySQLDatabase
11
{
12
    use ItFetchesMySQLDatabases, Retries;
13
14
    /**
15
     * Wait for MySQL database by name!
16
     *
17
     * @return mixed
18
     */
19
    protected function waitForMySQLDatabaseByName($database_name)
20
    {
21
        return $this->retry(50, function () use ($database_name) {
22
            $this->databases = $this->fetchMySQLDatabases();
0 ignored issues
show
Bug introduced by
The property databases does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
23
            $database = $this->getMysqlDatabaseByName($this->databases, $database_name);
24
            return $database['status'] == 'installed' ? $database : null;
25
        });
26
    }
27
}
28