Issues (2)

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/FieldFactory.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
/**
4
 * NOTICE OF LICENSE
5
 *
6
 * This source file is subject to the Open Software License (OSL 3.0)
7
 * that is available through the world-wide-web at this URL:
8
 * http://opensource.org/licenses/osl-3.0.php
9
 *
10
 * Some of this work is derived from mtdowling/cron-expression which is copyrighted as:
11
 * Copyright (c) 2011 Michael Dowling <[email protected]> and contributors
12
 * The licence of this work can be found here: https://github.com/mtdowling/cron-expression/blob/master/LICENSE
13
 *
14
 * Some limitations might apply.
15
 *
16
 * PHP version 5
17
 *
18
 * @category  Library
19
 * @package   Microcron
20
 * @author    Bernhard Wick <[email protected]>
21
 * @copyright 2015 TechDivision GmbH - <[email protected]>
22
 * @license   http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
23
 * @link      http://www.appserver.io/
24
 */
25
26
namespace AppserverIo\Microcron;
27
28
use Cron\FieldFactory as SimpleFieldFactory;
29
use Cron\MinutesField;
30
use Cron\HoursField;
31
use Cron\DayOfWeekField;
32
use Cron\DayOfMonthField;
33
use Cron\MonthField;
34
use Cron\YearField;
35
36
/**
37
 * AppserverIo\Microcron\FieldFactory
38
 *
39
 * Flyweight factory which allows for the creation of FieldInterface implementation objects
40
 *
41
 * @category  Library
42
 * @package   Microcron
43
 * @author    Bernhard Wick <[email protected]>
44
 * @copyright 2015 TechDivision GmbH - <[email protected]>
45
 * @license   http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
46
 * @link      http://www.appserver.io/
47
 */
48
class FieldFactory extends SimpleFieldFactory
49
{
50
    /**
51
     * @var array Cache of instantiated fields
52
     */
53
    private $fields = array();
0 ignored issues
show
Comprehensibility introduced by
Consider using a different property name as you override a private property of the parent class.
Loading history...
54
55
    /**
56
     * Get an instance of a field object for a cron expression position
57
     *
58
     * @param int $position CRON expression position value to retrieve
59
     *
60
     * @return \Cron\FieldInterface
61
     * @throws \InvalidArgumentException if a position is not valid
62
     */
63 3
    public function getField($position)
64
    {
65 3
        if (!isset($this->fields[$position])) {
66 3
            switch ($position) {
67 3
                case 0:
68 2
                    $this->fields[$position] = new SecondsField();
69 2
                    break;
70 3
                case 1:
71 2
                    $this->fields[$position] = new MinutesField();
72 2
                    break;
73 3
                case 2:
74 2
                    $this->fields[$position] = new HoursField();
75 2
                    break;
76 3
                case 3:
77 2
                    $this->fields[$position] = new DayOfMonthField();
78 2
                    break;
79 3
                case 4:
80 2
                    $this->fields[$position] = new MonthField();
81 2
                    break;
82 3
                case 5:
83 2
                    $this->fields[$position] = new DayOfWeekField();
84 2
                    break;
85 2
                case 6:
86 1
                    $this->fields[$position] = new YearField();
87 1
                    break;
88
                default:
89 1
                    throw new \InvalidArgumentException(
90 1
                        $position . ' is not a valid position'
91
                    );
92
            }
93
        }
94
95 2
        return $this->fields[$position];
96
    }
97
}
98