Issues (63)

Security Analysis    no request data  

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

src/Flow.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
/**
3
 * This file is part of graze/data-flow
4
 *
5
 * Copyright (c) 2016 Nature Delivered Ltd. <https://www.graze.com>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 *
10
 * @license https://github.com/graze/data-flow/blob/master/LICENSE.md
11
 * @link    https://github.com/graze/data-flow
12
 */
13
14
namespace Graze\DataFlow;
15
16
use Graze\DataFile\Node\FileNodeInterface;
17
use Graze\DataFlow\Flow\Runner\Run;
18
use Graze\DataNode\NodeInterface;
19
use Psr\Log\LoggerAwareInterface;
20
use Psr\Log\LoggerInterface;
21
use Psr\Log\LogLevel;
22
use ReflectionClass;
23
24
/**
25
 * Flow Facade
26
 *
27
 * @method static Flow run(FlowInterface ...$flows)
28
 * @method static Flow toAll(FlowInterface ...$flows)
29
 * @method static Flow first(callable $fn = null)
30
 * @method static Flow last(callable $fn = null)
31
 * @method static Flow filter(callable $fn = null)
32
 * @method static Flow map(callback $fn = null)
33
 * @method static Flow each(FlowInterface $flow)
34
 * @method static Flow callback(callable $fn = null)
35
 * @method static Flow makeDirectory($mode = 0777)
36
 * @method static Flow merge(FileNodeInterface $file, array $options = [])
37
 * @method static Flow compress($type, array $options = [])
38
 * @method static Flow decompress(array $options = [])
39
 * @method static Flow gzip()
40
 * @method static Flow gunzip()
41
 * @method static Flow zip()
42
 * @method static Flow unzip()
43
 * @method static Flow copyFile(FileNodeInterface $target);
44
 * @method static Flow copyFiles(FileNodeInterface $target);
45
 * @method static Flow moveFile(FileNodeInterface $target);
46
 * @method static Flow moveFiles(FileNodeInterface $target);
47
 * @method static Flow convertEncoding($newEncoding)
48
 * @method static Flow replaceText($from, $to)
49
 * @method static Flow tail($lines)
50
 * @method static Flow head($lines)
51
 */
52
class Flow extends Run
53
{
54
    /**
55
     * @inheritdoc
56
     */
57 44 View Code Duplication
    public function flow(NodeInterface $node)
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
58
    {
59 44
        $this->log(LogLevel::NOTICE, "Running through {count} flows", ['count' => count($this->items)]);
60
61 44
        $current = $node;
62 44
        foreach ($this->items as $flow) {
63 44
            $current = $flow->flow($current);
64 44
        }
65 44
        return $current;
66
    }
67
68
    /**
69
     * @var FlowBuilderInterface
70
     */
71
    protected static $builder;
72
73
    /**
74
     * @return FlowBuilderInterface
75
     */
76 47
    protected static function getBuilder()
77
    {
78 47
        if (!static::$builder instanceof FlowBuilderInterface) {
79 2
            static::$builder = new Builder();
80 2
        }
81 47
        return static::$builder;
82
    }
83
84
    /**
85
     * @param FlowBuilderInterface $builder
86
     */
87 2
    public static function setBuilder(FlowBuilderInterface $builder)
88
    {
89 2
        static::$builder = $builder;
90 2
    }
91
92
    /**
93
     * @param LoggerInterface $logger
94
     *
95
     * @return null|void
96
     */
97 1
    public static function useLogger(LoggerInterface $logger)
98
    {
99 1
        $builder = static::getBuilder();
100
101 1
        if ($builder instanceof LoggerAwareInterface) {
102 1
            $builder->setLogger($logger);
103 1
        }
104 1
    }
105
106
    /**
107
     * @param string $namespace
108
     */
109 1
    public static function with($namespace)
110
    {
111 1
        self::getBuilder()->addNamespace($namespace);
112 1
    }
113
114
    /**
115
     * @param string $flowName
116
     * @param array  $arguments
117
     *
118
     * @return Flow
119
     */
120 44
    public static function __callStatic($flowName, $arguments)
121
    {
122 44
        $flow = new static();
123 44
        return $flow->__call($flowName, $arguments);
124
    }
125
126
    /**
127
     * @param string $flowSpec
128
     * @param array  $arguments
129
     *
130
     * @return Flow
131
     */
132 45
    public static function buildFlow($flowSpec, $arguments = [])
133
    {
134 45
        return static::getBuilder()->buildFlow($flowSpec, $arguments);
135
    }
136
137
    /**
138
     * @param string $method
139
     * @param array  $arguments
140
     *
141
     * @return self
142
     */
143 45
    public function __call($method, $arguments)
144
    {
145 45
        return $this->add(static::buildFlow($method, $arguments));
146
    }
147
148
    /**
149
     * Create instance validator.
150
     *
151
     * @return Flow
152
     */
153 1
    public static function create()
154
    {
155 1
        $ref = new ReflectionClass(__CLASS__);
156 1
        return $ref->newInstanceArgs(func_get_args());
157
    }
158
}
159