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.

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/Xaoc303/BattleCalc/BattleCalc.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 namespace Xaoc303\BattleCalc;
2
3
use View;
4
5
/**
6
 * Class BattleCalc
7
 * @package Xaoc303\BattleCalc
8
 */
9
class BattleCalc
10
{
11
    /**
12
     * @var string
13
     */
14
    private $log = '';
15
16
    /**
17
     * @var int
18
     */
19
    private $round = 0;
20
21
    /**
22
     * @var Army
23
     */
24
    private $army1;
25
26
    /**
27
     * @var Army
28
     */
29
    private $army2;
30
31
    /**
32
     * calculation
33
     *
34
     * @param array $army_1
35
     * @param array $army_2
36
     * @return string
37
     */
38
    public function calculation(&$army_1, &$army_2)
39
    {
40
        $this->army1 = new Army($army_1);
41
        $this->army2 = new Army($army_2);
42
43
        $this->war();
44
45
        return $this->log;
46
    }
47
48
    /**
49
     * war
50
     */
51
    private function war()
52
    {
53
        $MaxIniciative = 0;
54
55
        $ManCount1 = $this->army1->manCount($MaxIniciative);
56
        $ManCount2 = $this->army2->manCount($MaxIniciative);
57
58
        $Round = 0;
59
        $this->round = $Round;
60
        $this->addLog($Round);
61
62
        while (($ManCount1 > 0) && ($ManCount2 > 0) && ($Round < 50)) {
63
            $this->battle($ManCount1, $ManCount2, $MaxIniciative, $Round);
64
65
            $Round++;
66
            $this->round = $Round;
67
            $MaxIniciative--;
68
            $this->addLog($Round);
69
        }
70
    }
71
72
    /**
73
     * battle
74
     *
75
     * @param integer $ManCount1
76
     * @param integer $ManCount2
77
     * @param integer $MaxIniciative
78
     * @param integer $Round
79
     */
80
    private function battle(&$ManCount1, &$ManCount2, &$MaxIniciative, &$Round)
81
    {
82
        $this->army1->shadow($this->army2, $MaxIniciative);
83
        $this->army2->shadow($this->army1, $MaxIniciative);
84
85
        $this->army1->clear();
86
        $this->army2->clear();
87
88
        ArmyAttack::run($this->army1, $this->army2, $MaxIniciative);
89
        ArmyAttack::run($this->army2, $this->army1, $MaxIniciative);
90
91
        $this->army1->attackNull($this->army2->manCountVisible(1));
92
        $this->army2->attackNull($this->army1->manCountVisible(1));
93
94
        ArmyLog::colorize($this->army1);
95
        ArmyLog::colorize($this->army2);
96
97
        if ($this->isExitRound($Round)) {
98
            ob_start();
99
            echo '$Round = '.$Round.'<br />';
100
            echo '$MaxIniciative = '.$MaxIniciative.'<br />';
101
            echo '$ManCount1 = '.$ManCount1.'<br />';
102
            echo '$ManCount2 = '.$ManCount2.'<br />';
103
            echo '<pre>'.print_r($this->army1, true).'</pre>';
104
            echo '<pre>'.print_r($this->army2, true).'</pre>';
105
            echo $this->log;
106
            ob_end_flush();
107
            exit;
0 ignored issues
show
Coding Style Compatibility introduced by
The method battle() contains an exit expression.

An exit expression should only be used in rare cases. For example, if you write a short command line script.

In most cases however, using an exit expression makes the code untestable and often causes incompatibilities with other libraries. Thus, unless you are absolutely sure it is required here, we recommend to refactor your code to avoid its usage.

Loading history...
108
        }
109
110
        ArmyDamage::run($this->army2, $this->army1);
111
        ArmyDamage::run($this->army1, $this->army2);
112
113
        $ManCount1 = $this->army1->count();
114
        $ManCount2 = $this->army2->count();
115
    }
116
117
    /**
118
     * exitRound
119
     *
120
     * @param integer $Round
121
     * @return bool
122
     */
123
    private function isExitRound($Round)
124
    {
125
        $ERound = false;
126
        /*
127
        int DamageT1 = 0;
128
        int DamageT2 = 0;
129
        int DamageA1 = 0;
130
        int DamageA2 = 0;
131
        int DamageM1 = 0;
132
        int DamageM2 = 0;
133
        int ManCountT1 = 0;
134
        int ManCountT2 = 0;
135
        int ManCountA1 = 0;
136
        int ManCountA2 = 0;
137
138
        for (int i=0; i<Army1.size(); i++)
139
        {
140
            DamageT1 += Army1[i].AttackTer;
141
            DamageA1 += Army1[i].AttackAir;
142
            DamageM1 += Army1[i].AttackMagic;
143
            if (Army1[i].UT==Ter) ManCountT1 += Army1[i].ManCount;
144
            if (Army1[i].UT==Air) ManCountA1 += Army1[i].ManCount;
145
        }
146
147
        for (int i=0; i<Army2.size(); i++)
148
        {
149
            DamageT2 += Army2[i].AttackTer;
150
            DamageA2 += Army2[i].AttackAir;
151
            DamageM2 += Army2[i].AttackMagic;
152
            if (Army2[i].UT==Ter) ManCountT2 += Army2[i].ManCount;
153
            if (Army2[i].UT==Air) ManCountA2 += Army2[i].ManCount;
154
        }
155
156
        if (ManCountT2==0)	DamageT1=0;
157
        if (ManCountA2==0)	DamageA1=0;
158
        if (ManCountT1==0)	DamageT2=0;
159
        if (ManCountA1==0)	DamageA2=0;
160
161
        if (Inic<0)
162
            if ((DamageT1==0 && DamageA1==0) || (DamageT2==0 && DamageA2==0))
163
                ERound = true;
164
        */
165
166
        if ($Round > 50) {
167
            $ERound = true;
168
        }
169
170
        return $ERound;
171
    }
172
173
    /**
174
     * addLog
175
     *
176
     * @param integer $Round
177
     */
178
    private function addLog($Round)
179
    {
180
        $this->log .= '----------------- ROUND   '.$Round.' ----------------';
181
        $this->log .= View::make('battle-calc::views.log')->with('units', $this->army1->getUnits())->render();
182
        $this->log .= View::make('battle-calc::views.log')->with('units', $this->army2->getUnits())->render();
183
        $this->log .= '<br />';
184
    }
185
}
186