CRM-14370 - civicrm_api, CiviUnitTestCase - Move main logic to Civi\API\Kernel

Also: Allow test-classes to use different API handlers (eg $apiKernel->run() instead of civicrm_api())

Conflicts:

	Civi/Core/Container.php
CRM-14370 - API Kernel - Dispatch events
CRM-14370 - API Kernel - Extract TransactionSubscriber
CRM-14370 - API Kernel - Extract XDebugSubscriber
CRM-14370 - API Kernel - DRY exception-handling; fix inconsistencies
CRM-14370 - API Kernel - DRY result formatting
CRM-14370 - API Kernel - Fix short-circuiting which breaks formatters/exceptions-handlers
CRM-14370 - API Kernel - Extract I18nSubscriber
CRM-14370 - API Kernel - Move authorization to listener
CRM-14370 - API Kernel - Extract APIv3SchemaAdapter
CRM-14370 - API Kernel - Extract WrapperAdapter
CRM-14370 - API Kernel - Extract createRequest()
CRM-14370 - API Kernel - Add ProviderInterface. Extract MagicFunctionProvider.
CRM-14370 - API Kernel - Parse options/data/chains for v4
civicrm_api3_create_error - Simplify
CRM-14370 - API Kernel - Move dispatch into helpers

Also: Use constants for error codes
CRM-14370 - Convert _civicrm_api3_api_check_permission to Civi\API\Subscriber\PermissionCheck

Also: Restrict old permissions checks to APIv3

Conflicts:

	Civi/Core/Container.php
CRM-14370 - API Kernel - Add UnauthorizedException, NotImplementedException

Conflicts:

	tests/phpunit/Civi/API/Provider/DoctrineCrudProviderTest.php
CRM-14370 - Move helper functions into classes

In particular:

 * civicrm_get_api_version => Kernel::parseVersion
 * _civicrm_api_resolve => MagicFunctionProvider::resolve
 * _civicrm_api_loadEntity => MagicFunctionProvider::loadEntity
 * civicrm_api_get_function_name => MagicFunctionProvider::getFunctionName
 * civicrm_api3_generic_getActions (partial) => MagicFunctionProvider::getActionNames

Conflicts:

	Civi/Core/Container.php
CRM-14370 - API Kernel - Move request parser to its own class