GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

PersistenceLegacy::flush()   A
last analyzed

Complexity

Conditions 4
Paths 4

Size

Total Lines 20
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 20
c 0
b 0
f 0
rs 9.2
cc 4
eloc 11
nc 4
nop 0
1
<?php
2
3
/**
4
 * This file is part of the PHPMongo package.
5
 *
6
 * (c) Dmytro Sokil <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Sokil\Mongo;
13
14
class PersistenceLegacy extends Persistence
15
{
16
    /**
17
     * Send data to database
18
     *
19
     * @return \Sokil\Mongo\Persistence
20
     */
21
    public function flush()
22
    {
23
        /** @var $document \Sokil\Mongo\Document */
24
        foreach ($this->pool as $document) {
25
            switch ($this->pool->offsetGet($document)) {
26
                case self::STATE_SAVE:
27
                    $document->save();
28
                    break;
29
30
                case self::STATE_REMOVE:
31
                    // delete document form db
32
                    $document->delete();
33
                    // remove link form pool
34
                    $this->detach($document);
35
                    break;
36
            }
37
        }
38
39
        return $this;
40
    }
41
}
42