google_login.php ➔ ndfasui8923()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 10
nc 1
nop 2
dl 0
loc 11
rs 9.4285
c 0
b 0
f 0
1
<?php
0 ignored issues
show
Coding Style Compatibility introduced by
For compatibility and reusability of your code, PSR1 recommends that a file should introduce either new symbols (like classes, functions, etc.) or have side-effects (like outputting something, or including other files), but not both at the same time. The first symbol is defined on line 19 and the first side effect is on line 30.

The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.

The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.

To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.

Loading history...
2
/**
3
 * Automated google account login.
4
 * Uses __config.php to keep login data.
5
 *
6
 * @package PhpQuery.Plugins.Scripts
7
 * @author Tobiasz Cudnik <tobiasz.cudnik/gmail.com>
8
 */
9
use PhpQuery\PhpQuery;
0 ignored issues
show
Bug introduced by
This use statement conflicts with another class in this namespace, PhpQuery.

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...
10
11
PhpQuery::ajaxAllowHost(
12
	'code.google.com',
13
	'google.com', 'www.google.com',
14
	'mail.google.com',
15
	'docs.google.com',
16
	'reader.google.com'
17
);
18
if (! function_exists('ndfasui8923')) {
19
	function ndfasui8923($browser, $scope) {
20
		extract($scope);
21
		$browser
22
			->WebBrowser()
23
			->find('#Email')
24
				->val($config['google_login'][0])->end()
25
			->find('#Passwd')
26
				->val($config['google_login'][1])
27
				->parents('form')
28
					->submit();
29
	}
30
	$ndfasui8923 = new Callback('ndfasui8923', new CallbackParam, compact(
31
		'config', 'self', 'return', 'params'
32
	));
33
}
34
PhpQuery::plugin('WebBrowser');
35
$self->document->xhr = PhpQuery::$plugins->browserGet(
36
	'https://www.google.com/accounts/Login',
37
	$ndfasui8923
38
);
39
//$self->document->xhr = PhpQuery::$plugins->browserGet('https://www.google.com/accounts/Login', create_function('$browser', "
0 ignored issues
show
Unused Code Comprehensibility introduced by
71% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
40
//	\$browser
41
//		->WebBrowser()
42
//		->find('#Email')
43
//			->val('{$config['google_login'][0]}')->end()
44
//		->find('#Passwd')
45
//			->val('".str_replace("'", "\\'", $config['google_login'][1])."')
46
//			->parents('form')
47
//				->submit();"
48
//));