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.
Passed
Pull Request — master (#2)
by Serge
01:54
created

bigtest.php (1 issue)

Labels
Severity

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
declare(strict_types = 1);
3
// Since we want to profile all the code, include Profiler class before vendor/autoload.php.
4
require_once 'class/Profiler.php';
5
use Converter\Tools\Profiler;
6
$profiler = new Profiler();
7
//Start the Profiler
8
$profiler->Start();
9
10
//Autoload dependencies
11
require_once('vendor/autoload.php');
12
use Converter\Core\Number2Text;
13
use Converter\Demo\Generator;
0 ignored issues
show
This use statement conflicts with another class in this namespace, Generator.

Let’s assume that you have a directory layout like this:

.
|-- OtherDir
|   |-- Bar.php
|   `-- Foo.php
`-- SomeDir
    `-- Foo.php

and let’s assume the following content of Bar.php:

// Bar.php
namespace OtherDir;

use SomeDir\Foo; // This now conflicts the class OtherDir\Foo

If both files OtherDir/Foo.php and SomeDir/Foo.php are loaded in the same runtime, you will see a PHP error such as the following:

PHP Fatal error:  Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.php

However, as OtherDir/Foo.php does not necessarily have to be loaded and the error is only triggered if it is loaded before OtherDir/Bar.php, this problem might go unnoticed for a while. In order to prevent this error from surfacing, you must import the namespace with a different alias:

// Bar.php
namespace OtherDir;

use SomeDir\Foo as SomeDirFoo; // There is no conflict anymore.
Loading history...
14
15
//Generate random numbers and print results of conversion
16
$zerofill = false;
17
$source = Generator::generate();
18
$number = new Number2Text($source);
19
$number->currency(true);
20
21
$power = Generator::$exponent;
22
$base = Generator::$mantissa;
23
$base_check = strlen((string)($base / 10));
24
25
if ($base_check == 1) {
26
    $base = $base / 10;
27
    $power += 1;
28
}
29
30
echo '<strong>Input Number: </strong>' . $source . '<br><br>';
31
echo '<strong>Exponential form: </strong>';
32
if ($base != 0) {
33
    echo $zerofill === true ? $base . '•10' : 'RND•e';
34
    echo Generator::$sign == '-' ? '-' : '+';
35
    echo "<span style='position: relative; bottom: 1ex; font-size: 70%;'>" . $power . "</span>";
36
}
37
echo '<br><br>';
38
echo '<strong>Converted string: </strong>' . mb_strtoupper($number->convert());
39
echo '<br><br>';
40
41
//Stop Profiler and show total execution time
42
$profiler->Stop();
43