Commit 0058e201 authored by Gert's avatar Gert

Initial commit

parents

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.

## 1.2.0
* Initial split from the [php-integrator/atom-base](https://github.com/php-integrator/atom-base) repository. See [its changelog](https://github.com/php-integrator/atom-base/blob/master/CHANGELOG.md) for what changed in older versions.
Whoa, there! Thanks for contributing by reporting issues, but before you do, check that you can answer all the following questions with a firm **Yes**:
* Have I checked the existing open issues?
* More importantly, have I checked the existing closed issues?
* If I've just installed or updated...
* ... have I checked the **CHANGELOG** and the **README**?
* ... have I tried removing and reinstalling the package and then restarting Atom to ensure Atom didn't break it?
If you've answered **Yes** to all these questions, please do tell us what the problem is (you can remove this text first).
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
# php-integrator/core
<p align="right">
:coffee:
<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YKTNLZCRHMRTJ">Send me some coffee beans</a>
</p>
PHP Integrator indexes PHP code and performs static analysis. This information is stored in an index database and the
command line can then be used to fetch information in JSON format to provide various functionalities, such as
autocompletion, code navigation and tooltips.
## Why are the Composer dependencies in Git?
This is something I'd rather have avoided, but as this code acts as a sort of payload for editor extensions and plugins
that are usually written in another language, stripping the dependencies requires those plugins to install them again
via composer. This in turn requests that the users of those plugins have composer installed as well, which increases the
entry barrier for new users.
## Where is it used?
Currently the core package is used to power the php-integrator-* packages for the Atom editor. See also [the list of projects](https://github.com/php-integrator).
![GPLv3 Logo](http://gplv3.fsf.org/gplv3-127x51.png)
{
"name": "php-integrator/core",
"type": "project",
"description": "PHP code analysis and utilities",
"keywords": ["static", "analysis", "indexing", "indexer", "integrator", "autocompletion", "refactoring"],
"homepage": "https://php-integrator.github.io/",
"license": "GPL-3.0",
"autoload": {
"classmap": ["src/", "tests/"],
"psr-4": {
"PhpIntegrator\\": "src/"
}
},
"require": {
"php": ">=5.5.0",
"ext-mbstring": "*",
"ext-pdo_sqlite": "*",
"nikic/php-parser": "~2.1.0",
"doctrine/dbal": "~2.5",
"corneltek/getoptionkit": "~2.3.0"
},
"require-dev": {
"phpunit/phpunit": "~5.4.0"
},
"scripts": {
"test" : "vendor/bin/phpunit tests"
}
}
This diff is collapsed.
{
"name": "php-integrator-core",
"main": "./lib/Main",
"version": "1.2.6",
"description": "Core package for PHP integrator, which contains the PHP payload for php-integrator-base.",
"repository": "https://github.com/php-integrator/core.git",
"license": "GPL-3.0",
"engines": {},
"dependencies": {},
"keywords": [
"php",
"service",
"integrator",
"integration",
"php-integrator"
]
}
<phpunit colors="true" stopOnError="true" stopOnFailure="true" bootstrap="vendor/autoload.php">
<testsuites>
<testsuite name="php-integrator">
<directory>tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">src</directory>
<exclude>
<file>src/Main.php</file>
</exclude>
</whitelist>
</filter>
</phpunit>
<?php
namespace PhpIntegrator;
use Exception;
use UnexpectedValueException;
use Doctrine\Common\Cache\FilesystemCache;
use PhpIntegrator\Application\Command\CachingParserProxy;
use PhpParser\Lexer;
use PhpParser\Parser;
use PhpParser\ParserFactory;
/**
* Main application class.
*/
class Application
{
/**
* @var FilesystemCache
*/
protected $filesystemCache;
/**
* @var CachingParserProxy
*/
protected $cachingParserProxy;
/**
* @var Parser
*/
protected $parser;
/**
* Handles the application process.
*
* @param array $arguments The arguments to pass.
*
* @return mixed
*/
public function handle(array $arguments)
{
if (count($arguments) < 3) {
throw new UnexpectedValueException('Not enough argument supplied. Usage: . <project> <command> [<addtional parameters>]');
}
$programName = array_shift($arguments);
$projectName = array_shift($arguments);
$command = array_shift($arguments);
// This seems to be needed for GetOptionKit.
array_unshift($arguments, $programName);
$commands = [
'--class-list' => 'ClassList',
'--class-info' => 'ClassInfo',
'--functions' => 'GlobalFunctions',
'--constants' => 'GlobalConstants',
'--reindex' => 'Reindex',
'--resolve-type' => 'ResolveType',
'--localize-type' => 'LocalizeType',
'--semantic-lint' => 'SemanticLint',