Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
This commit is contained in:
Arthur Schiwon 2020-05-07 18:41:36 +02:00 коммит произвёл backportbot[bot]
Родитель 4508c5832b
Коммит e09cf2145a
324 изменённых файлов: 5 добавлений и 15372 удалений

4
.gitignore поставляемый
Просмотреть файл

@ -1,4 +1,2 @@
composer.phar
/vendor/vgrem/php-spo/examples/
/vendor/vgrem/php-spo/tests/
/vendor/cweagans/composer-patches/tests/
/vendor/

Просмотреть файл

@ -29,6 +29,9 @@ matrix:
before_install:
- wget https://raw.githubusercontent.com/nextcloud/travis_ci/master/before_install.sh
- . ./before_install.sh $APP_NAME $CORE_BRANCH $DB
- cd ../server/apps/$APP_NAME
- composer install
- cd ../../
# Add some output debugging information
- cd ../server
@ -40,7 +43,7 @@ before_install:
- ./occ app:list
script:
- cd apps/$APP_NAME/
- cd apps/$APP_NAME/
# Test the app
- sh -c "if [ '$CODECHECK' = '1' ]; then find . -name \*.php -exec php -l \"{}\" \;; fi"

7
vendor/autoload.php поставляемый
Просмотреть файл

@ -1,7 +0,0 @@
<?php
// autoload.php @generated by Composer
require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInit82146dde0dfabe7377397a545ea69179::getLoader();

445
vendor/composer/ClassLoader.php поставляемый
Просмотреть файл

@ -1,445 +0,0 @@
<?php
/*
* This file is part of Composer.
*
* (c) Nils Adermann <naderman@naderman.de>
* Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Composer\Autoload;
/**
* ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
*
* $loader = new \Composer\Autoload\ClassLoader();
*
* // register classes with namespaces
* $loader->add('Symfony\Component', __DIR__.'/component');
* $loader->add('Symfony', __DIR__.'/framework');
*
* // activate the autoloader
* $loader->register();
*
* // to enable searching the include path (eg. for PEAR packages)
* $loader->setUseIncludePath(true);
*
* In this example, if you try to use a class in the Symfony\Component
* namespace or one of its children (Symfony\Component\Console for instance),
* the autoloader will first look for the class under the component/
* directory, and it will then fallback to the framework/ directory if not
* found before giving up.
*
* This class is loosely based on the Symfony UniversalClassLoader.
*
* @author Fabien Potencier <fabien@symfony.com>
* @author Jordi Boggiano <j.boggiano@seld.be>
* @see http://www.php-fig.org/psr/psr-0/
* @see http://www.php-fig.org/psr/psr-4/
*/
class ClassLoader
{
// PSR-4
private $prefixLengthsPsr4 = array();
private $prefixDirsPsr4 = array();
private $fallbackDirsPsr4 = array();
// PSR-0
private $prefixesPsr0 = array();
private $fallbackDirsPsr0 = array();
private $useIncludePath = false;
private $classMap = array();
private $classMapAuthoritative = false;
private $missingClasses = array();
private $apcuPrefix;
public function getPrefixes()
{
if (!empty($this->prefixesPsr0)) {
return call_user_func_array('array_merge', $this->prefixesPsr0);
}
return array();
}
public function getPrefixesPsr4()
{
return $this->prefixDirsPsr4;
}
public function getFallbackDirs()
{
return $this->fallbackDirsPsr0;
}
public function getFallbackDirsPsr4()
{
return $this->fallbackDirsPsr4;
}
public function getClassMap()
{
return $this->classMap;
}
/**
* @param array $classMap Class to filename map
*/
public function addClassMap(array $classMap)
{
if ($this->classMap) {
$this->classMap = array_merge($this->classMap, $classMap);
} else {
$this->classMap = $classMap;
}
}
/**
* Registers a set of PSR-0 directories for a given prefix, either
* appending or prepending to the ones previously set for this prefix.
*
* @param string $prefix The prefix
* @param array|string $paths The PSR-0 root directories
* @param bool $prepend Whether to prepend the directories
*/
public function add($prefix, $paths, $prepend = false)
{
if (!$prefix) {
if ($prepend) {
$this->fallbackDirsPsr0 = array_merge(
(array) $paths,
$this->fallbackDirsPsr0
);
} else {
$this->fallbackDirsPsr0 = array_merge(
$this->fallbackDirsPsr0,
(array) $paths
);
}
return;
}
$first = $prefix[0];
if (!isset($this->prefixesPsr0[$first][$prefix])) {
$this->prefixesPsr0[$first][$prefix] = (array) $paths;
return;
}
if ($prepend) {
$this->prefixesPsr0[$first][$prefix] = array_merge(
(array) $paths,
$this->prefixesPsr0[$first][$prefix]
);
} else {
$this->prefixesPsr0[$first][$prefix] = array_merge(
$this->prefixesPsr0[$first][$prefix],
(array) $paths
);
}
}
/**
* Registers a set of PSR-4 directories for a given namespace, either
* appending or prepending to the ones previously set for this namespace.
*
* @param string $prefix The prefix/namespace, with trailing '\\'
* @param array|string $paths The PSR-4 base directories
* @param bool $prepend Whether to prepend the directories
*
* @throws \InvalidArgumentException
*/
public function addPsr4($prefix, $paths, $prepend = false)
{
if (!$prefix) {
// Register directories for the root namespace.
if ($prepend) {
$this->fallbackDirsPsr4 = array_merge(
(array) $paths,
$this->fallbackDirsPsr4
);
} else {
$this->fallbackDirsPsr4 = array_merge(
$this->fallbackDirsPsr4,
(array) $paths
);
}
} elseif (!isset($this->prefixDirsPsr4[$prefix])) {
// Register directories for a new namespace.
$length = strlen($prefix);
if ('\\' !== $prefix[$length - 1]) {
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
}
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
$this->prefixDirsPsr4[$prefix] = (array) $paths;
} elseif ($prepend) {
// Prepend directories for an already registered namespace.
$this->prefixDirsPsr4[$prefix] = array_merge(
(array) $paths,
$this->prefixDirsPsr4[$prefix]
);
} else {
// Append directories for an already registered namespace.
$this->prefixDirsPsr4[$prefix] = array_merge(
$this->prefixDirsPsr4[$prefix],
(array) $paths
);
}
}
/**
* Registers a set of PSR-0 directories for a given prefix,
* replacing any others previously set for this prefix.
*
* @param string $prefix The prefix
* @param array|string $paths The PSR-0 base directories
*/
public function set($prefix, $paths)
{
if (!$prefix) {
$this->fallbackDirsPsr0 = (array) $paths;
} else {
$this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
}
}
/**
* Registers a set of PSR-4 directories for a given namespace,
* replacing any others previously set for this namespace.
*
* @param string $prefix The prefix/namespace, with trailing '\\'
* @param array|string $paths The PSR-4 base directories
*
* @throws \InvalidArgumentException
*/
public function setPsr4($prefix, $paths)
{
if (!$prefix) {
$this->fallbackDirsPsr4 = (array) $paths;
} else {
$length = strlen($prefix);
if ('\\' !== $prefix[$length - 1]) {
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
}
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
$this->prefixDirsPsr4[$prefix] = (array) $paths;
}
}
/**
* Turns on searching the include path for class files.
*
* @param bool $useIncludePath
*/
public function setUseIncludePath($useIncludePath)
{
$this->useIncludePath = $useIncludePath;
}
/**
* Can be used to check if the autoloader uses the include path to check
* for classes.
*
* @return bool
*/
public function getUseIncludePath()
{
return $this->useIncludePath;
}
/**
* Turns off searching the prefix and fallback directories for classes
* that have not been registered with the class map.
*
* @param bool $classMapAuthoritative
*/
public function setClassMapAuthoritative($classMapAuthoritative)
{
$this->classMapAuthoritative = $classMapAuthoritative;
}
/**
* Should class lookup fail if not found in the current class map?
*
* @return bool
*/
public function isClassMapAuthoritative()
{
return $this->classMapAuthoritative;
}
/**
* APCu prefix to use to cache found/not-found classes, if the extension is enabled.
*
* @param string|null $apcuPrefix
*/
public function setApcuPrefix($apcuPrefix)
{
$this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
}
/**
* The APCu prefix in use, or null if APCu caching is not enabled.
*
* @return string|null
*/
public function getApcuPrefix()
{
return $this->apcuPrefix;
}
/**
* Registers this instance as an autoloader.
*
* @param bool $prepend Whether to prepend the autoloader or not
*/
public function register($prepend = false)
{
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
}
/**
* Unregisters this instance as an autoloader.
*/
public function unregister()
{
spl_autoload_unregister(array($this, 'loadClass'));
}
/**
* Loads the given class or interface.
*
* @param string $class The name of the class
* @return bool|null True if loaded, null otherwise
*/
public function loadClass($class)
{
if ($file = $this->findFile($class)) {
includeFile($file);
return true;
}
}
/**
* Finds the path to the file where the class is defined.
*
* @param string $class The name of the class
*
* @return string|false The path if found, false otherwise
*/
public function findFile($class)
{
// class map lookup
if (isset($this->classMap[$class])) {
return $this->classMap[$class];
}
if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
return false;
}
if (null !== $this->apcuPrefix) {
$file = apcu_fetch($this->apcuPrefix.$class, $hit);
if ($hit) {
return $file;
}
}
$file = $this->findFileWithExtension($class, '.php');
// Search for Hack files if we are running on HHVM
if (false === $file && defined('HHVM_VERSION')) {
$file = $this->findFileWithExtension($class, '.hh');
}
if (null !== $this->apcuPrefix) {
apcu_add($this->apcuPrefix.$class, $file);
}
if (false === $file) {
// Remember that this class does not exist.
$this->missingClasses[$class] = true;
}
return $file;
}
private function findFileWithExtension($class, $ext)
{
// PSR-4 lookup
$logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
$first = $class[0];
if (isset($this->prefixLengthsPsr4[$first])) {
$subPath = $class;
while (false !== $lastPos = strrpos($subPath, '\\')) {
$subPath = substr($subPath, 0, $lastPos);
$search = $subPath . '\\';
if (isset($this->prefixDirsPsr4[$search])) {
$pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
foreach ($this->prefixDirsPsr4[$search] as $dir) {
if (file_exists($file = $dir . $pathEnd)) {
return $file;
}
}
}
}
}
// PSR-4 fallback dirs
foreach ($this->fallbackDirsPsr4 as $dir) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
return $file;
}
}
// PSR-0 lookup
if (false !== $pos = strrpos($class, '\\')) {
// namespaced class name
$logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
. strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
} else {
// PEAR-like class name
$logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
}
if (isset($this->prefixesPsr0[$first])) {
foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
if (0 === strpos($class, $prefix)) {
foreach ($dirs as $dir) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
return $file;
}
}
}
}
}
// PSR-0 fallback dirs
foreach ($this->fallbackDirsPsr0 as $dir) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
return $file;
}
}
// PSR-0 include paths.
if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
return $file;
}
return false;
}
}
/**
* Scope isolated include.
*
* Prevents access to $this/self from included files.
*/
function includeFile($file)
{
include $file;
}

21
vendor/composer/LICENSE поставляемый
Просмотреть файл

@ -1,21 +0,0 @@
Copyright (c) Nils Adermann, Jordi Boggiano
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

9
vendor/composer/autoload_classmap.php поставляемый
Просмотреть файл

@ -1,9 +0,0 @@
<?php
// autoload_classmap.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
);

9
vendor/composer/autoload_namespaces.php поставляемый
Просмотреть файл

@ -1,9 +0,0 @@
<?php
// autoload_namespaces.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
);

11
vendor/composer/autoload_psr4.php поставляемый
Просмотреть файл

@ -1,11 +0,0 @@
<?php
// autoload_psr4.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
'cweagans\\Composer\\' => array($vendorDir . '/cweagans/composer-patches/src'),
'Office365\\PHP\\Client\\' => array($vendorDir . '/vgrem/php-spo/src'),
);

52
vendor/composer/autoload_real.php поставляемый
Просмотреть файл

@ -1,52 +0,0 @@
<?php
// autoload_real.php @generated by Composer
class ComposerAutoloaderInit82146dde0dfabe7377397a545ea69179
{
private static $loader;
public static function loadClassLoader($class)
{
if ('Composer\Autoload\ClassLoader' === $class) {
require __DIR__ . '/ClassLoader.php';
}
}
public static function getLoader()
{
if (null !== self::$loader) {
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInit82146dde0dfabe7377397a545ea69179', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
spl_autoload_unregister(array('ComposerAutoloaderInit82146dde0dfabe7377397a545ea69179', 'loadClassLoader'));
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
if ($useStaticLoader) {
require_once __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInit82146dde0dfabe7377397a545ea69179::getInitializer($loader));
} else {
$map = require __DIR__ . '/autoload_namespaces.php';
foreach ($map as $namespace => $path) {
$loader->set($namespace, $path);
}
$map = require __DIR__ . '/autoload_psr4.php';
foreach ($map as $namespace => $path) {
$loader->setPsr4($namespace, $path);
}
$classMap = require __DIR__ . '/autoload_classmap.php';
if ($classMap) {
$loader->addClassMap($classMap);
}
}
$loader->register(true);
return $loader;
}
}

39
vendor/composer/autoload_static.php поставляемый
Просмотреть файл

@ -1,39 +0,0 @@
<?php
// autoload_static.php @generated by Composer
namespace Composer\Autoload;
class ComposerStaticInit82146dde0dfabe7377397a545ea69179
{
public static $prefixLengthsPsr4 = array (
'c' =>
array (
'cweagans\\Composer\\' => 18,
),
'O' =>
array (
'Office365\\PHP\\Client\\' => 21,
),
);
public static $prefixDirsPsr4 = array (
'cweagans\\Composer\\' =>
array (
0 => __DIR__ . '/..' . '/cweagans/composer-patches/src',
),
'Office365\\PHP\\Client\\' =>
array (
0 => __DIR__ . '/..' . '/vgrem/php-spo/src',
),
);
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit82146dde0dfabe7377397a545ea69179::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit82146dde0dfabe7377397a545ea69179::$prefixDirsPsr4;
}, null, ClassLoader::class);
}
}

99
vendor/composer/installed.json поставляемый
Просмотреть файл

@ -1,99 +0,0 @@
[
{
"name": "cweagans/composer-patches",
"version": "1.6.1",
"version_normalized": "1.6.1.0",
"source": {
"type": "git",
"url": "https://github.com/cweagans/composer-patches.git",
"reference": "b3036f23b73570ab5d869e345277786c8eb248a9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/cweagans/composer-patches/zipball/b3036f23b73570ab5d869e345277786c8eb248a9",
"reference": "b3036f23b73570ab5d869e345277786c8eb248a9",
"shasum": ""
},
"require": {
"composer-plugin-api": "^1.0",
"php": ">=5.3.0"
},
"require-dev": {
"composer/composer": "~1.0",
"phpunit/phpunit": "~4.6"
},
"time": "2017-03-19T18:18:52+00:00",
"type": "composer-plugin",
"extra": {
"class": "cweagans\\Composer\\Patches"
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"cweagans\\Composer\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-2-Clause"
],
"authors": [
{
"name": "Cameron Eagans",
"email": "me@cweagans.net"
}
],
"description": "Provides a way to patch Composer packages."
},
{
"name": "vgrem/php-spo",
"version": "dev-master",
"version_normalized": "9999999-dev",
"source": {
"type": "git",
"url": "https://github.com/vgrem/phpSPO.git",
"reference": "9a866bae3552d01b8a8e33ddd8faf8adc66e2423"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/vgrem/phpSPO/zipball/9a866bae3552d01b8a8e33ddd8faf8adc66e2423",
"reference": "9a866bae3552d01b8a8e33ddd8faf8adc66e2423",
"shasum": ""
},
"require": {
"ext-curl": "*",
"php": ">=5.4"
},
"time": "2017-04-19T08:17:21+00:00",
"type": "library",
"extra": {
"patches_applied": {
"Remove proccessed queries from queue": "https://patch-diff.githubusercontent.com/raw/vgrem/phpSPO/pull/63.patch"
}
},
"installation-source": "source",
"autoload": {
"psr-4": {
"Office365\\PHP\\Client\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"LGPL-3.0+"
],
"authors": [
{
"name": "Vadim Gremyachev",
"email": "vvgrem@gmail.com"
}
],
"description": "The library provides a Office 365 REST client for PHP. It allows to performs CRUD operations against Office 365 resources via an REST/OData based API",
"keywords": [
"Office365",
"api",
"curl",
"rest",
"sharepoint"
]
}
]

Просмотреть файл

@ -1,11 +0,0 @@
# This is the top-most .editorconfig file; do not search in parent directories.
root = true
# All files.
[*]
end_of_line = LF
indent_style = space
indent_size = 2
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

1
vendor/cweagans/composer-patches/.gitignore поставляемый
Просмотреть файл

@ -1 +0,0 @@
vendor/

155
vendor/cweagans/composer-patches/README.md поставляемый
Просмотреть файл

@ -1,155 +0,0 @@
# composer-patches
Simple patches plugin for Composer. Applies a patch from a local or remote file to any package required with composer.
## Usage
Example composer.json:
```json
{
"require": {
"cweagans/composer-patches": "~1.0",
"drupal/drupal": "~8.2"
},
"config": {
"preferred-install": "source"
},
"extra": {
"patches": {
"drupal/drupal": {
"Add startup configuration for PHP server": "https://www.drupal.org/files/issues/add_a_startup-1543858-30.patch"
}
}
}
}
```
## Using an external patch file
Instead of a patches key in your root composer.json, use a patches-file key.
```json
{
"require": {
"cweagans/composer-patches": "~1.0",
"drupal/drupal": "~8.2"
},
"config": {
"preferred-install": "source"
},
"extra": {
"patches-file": "local/path/to/your/composer.patches.json"
}
}
```
Then your `composer.patches.json` should look like this:
```
{
"patches": {
"vendor/project": {
"Patch title": "http://example.com/url/to/patch.patch"
}
}
}
```
## Allowing patches to be applied from dependencies
If you want your project to accept patches from dependencies, you must have the following in your composer file:
```json
{
"require": {
"cweagans/composer-patches": "^1.5.0"
},
"extra": {
"enable-patching": true
}
}
```
## Ignoring patches
There may be situations in which you want to ignore a patch supplied by a dependency. For example:
- You use a different more recent version of a dependency, and now a patch isn't applying.
- You have a more up to date patch than the dependency, and want to use yours instead of theirs.
- A dependency's patch adds a feature to a project that you don't need.
- Your patches conflict with a dependency's patches.
```json
{
"require": {
"cweagans/composer-patches": "~1.0",
"drupal/drupal": "~8.2",
"drupal/lightning": "~8.1"
},
"config": {
"preferred-install": "source"
},
"extra": {
"patches": {
"drupal/drupal": {
"Add startup configuration for PHP server": "https://www.drupal.org/files/issues/add_a_startup-1543858-30.patch"
}
},
"patches-ignore": {
"drupal/lightning": {
"drupal/panelizer": {
"This patch has known conflicts with our Quick Edit integration": "https://www.drupal.org/files/issues/2664682-49.patch"
}
}
}
}
}
```
## Using patches from HTTP URLs
Composer [blocks](https://getcomposer.org/doc/06-config.md#secure-http) you from downloading anything from HTTP URLs, you can disable this for your project by adding a `secure-http` setting in the config section of your `composer.json`. Note that the `config` section should be under the root of your `composer.json`.
```json
{
"config": {
"secure-http": false
}
}
```
However, it's always advised to setup HTTPS to prevent MITM code injection.
## Patches containing modifications to composer.json files
Because patching occurs _after_ Composer calculates dependencies and installs packages, changes to an underlying dependency's `composer.json` file introduced in a patch will have _no effect_ on installed packages.
If you need to modify a dependency's `composer.json` or its underlying dependencies, you cannot use this plugin. Instead, you must do one of the following:
- Work to get the underlying issue resolved in the upstream package.
- Fork the package and [specify your fork as the package repository](https://getcomposer.org/doc/05-repositories.md#vcs) in your root `composer.json`
- Specify compatible package version requirements in your root `composer.json`
## Error handling
If a patch cannot be applied (hunk failed, different line endings, etc.) a message will be shown and the patch will be skipped.
To enforce throwing an error and stopping package installation/update immediately, you have two available options:
1. Add `"composer-exit-on-patch-failure": true` option to the `extra` section of your composer.json file.
1. Export `COMPOSER_EXIT_ON_PATCH_FAILURE=1`
By default, failed patches are skipped.
## Difference between this and netresearch/composer-patches-plugin
- This plugin is much more simple to use and maintain
- This plugin doesn't require you to specify which package version you're patching
- This plugin is easy to use with Drupal modules (which don't use semantic versioning).
- This plugin will gather patches from all dependencies and apply them as if they were in the root composer.json
## Credits
A ton of this code is adapted or taken straight from https://github.com/jpstacey/composer-patcher, which is abandoned in favor of https://github.com/netresearch/composer-patches-plugin, which is (IMHO) overly complex and difficult to use.

Просмотреть файл

@ -1,30 +0,0 @@
{
"name": "cweagans/composer-patches",
"description": "Provides a way to patch Composer packages.",
"minimum-stability": "dev",
"license": "BSD-2-Clause",
"type": "composer-plugin",
"extra": {
"class": "cweagans\\Composer\\Patches"
},
"authors": [
{
"name": "Cameron Eagans",
"email": "me@cweagans.net"
}
],
"require": {
"php": ">=5.3.0",
"composer-plugin-api": "^1.0"
},
"require-dev": {
"composer/composer": "~1.0",
"phpunit/phpunit": "~4.6"
},
"autoload": {
"psr-4": {"cweagans\\Composer\\": "src"}
},
"autoload-dev": {
"psr-4": {"cweagans\\Composer\\Tests\\": "tests"}
}
}

1564
vendor/cweagans/composer-patches/composer.lock сгенерированный поставляемый

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -1,18 +0,0 @@
<!--?xml version="1.0" encoding="UTF-8"?-->
<phpunit colors="true" bootstrap="vendor/autoload.php">
<testsuites>
<testsuite name="composer-patches">
<directory>./tests/</directory>
</testsuite>
</testsuites>
<!-- Filter for coverage reports. -->
<filter>
<whitelist>
<directory>src/</directory>
</whitelist>
<blacklist>
<directory>vendor/</directory>
</blacklist>
</filter>
</phpunit>

Просмотреть файл

@ -1,70 +0,0 @@
<?php
/**
* @file
* Dispatch events when patches are applied.
*/
namespace cweagans\Composer;
use Composer\EventDispatcher\Event;
use Composer\Package\PackageInterface;
class PatchEvent extends Event {
/**
* @var PackageInterface $package
*/
protected $package;
/**
* @var string $url
*/
protected $url;
/**
* @var string $description
*/
protected $description;
/**
* Constructs a PatchEvent object.
*
* @param string $eventName
* @param PackageInterface $package
* @param string $url
* @param string $description
*/
public function __construct($eventName, PackageInterface $package, $url, $description) {
parent::__construct($eventName);
$this->package = $package;
$this->url = $url;
$this->description = $description;
}
/**
* Returns the package that is patched.
*
* @return PackageInterface
*/
public function getPackage() {
return $this->package;
}
/**
* Returns the url of the patch.
*
* @return string
*/
public function getUrl() {
return $this->url;
}
/**
* Returns the description of the patch.
*
* @return string
*/
public function getDescription() {
return $this->description;
}
}

Просмотреть файл

@ -1,30 +0,0 @@
<?php
/**
* @file
* Dispatch events when patches are applied.
*/
namespace cweagans\Composer;
class PatchEvents {
/**
* The PRE_PATCH_APPLY event occurs before a patch is applied.
*
* The event listener method receives a cweagans\Composer\PatchEvent instance.
*
* @var string
*/
const PRE_PATCH_APPLY = 'pre-patch-apply';
/**
* The POST_PATCH_APPLY event occurs after a patch is applied.
*
* The event listener method receives a cweagans\Composer\PatchEvent instance.
*
* @var string
*/
const POST_PATCH_APPLY = 'post-patch-apply';
}

Просмотреть файл

@ -1,491 +0,0 @@
<?php
/**
* @file
* Provides a way to patch Composer packages after installation.
*/
namespace cweagans\Composer;
use Composer\Composer;
use Composer\DependencyResolver\Operation\InstallOperation;
use Composer\DependencyResolver\Operation\UninstallOperation;
use Composer\DependencyResolver\Operation\UpdateOperation;
use Composer\DependencyResolver\Operation\OperationInterface;
use Composer\EventDispatcher\EventSubscriberInterface;
use Composer\IO\IOInterface;
use Composer\Package\AliasPackage;
use Composer\Package\PackageInterface;
use Composer\Plugin\PluginInterface;
use Composer\Installer\PackageEvents;
use Composer\Script\Event;
use Composer\Script\ScriptEvents;
use Composer\Installer\PackageEvent;
use Composer\Util\ProcessExecutor;
use Composer\Util\RemoteFilesystem;
use Symfony\Component\Process\Process;
class Patches implements PluginInterface, EventSubscriberInterface {
/**
* @var Composer $composer
*/
protected $composer;
/**
* @var IOInterface $io
*/
protected $io;
/**
* @var EventDispatcher $eventDispatcher
*/
protected $eventDispatcher;
/**
* @var ProcessExecutor $executor
*/
protected $executor;
/**
* @var array $patches
*/
protected $patches;
/**
* Apply plugin modifications to composer
*
* @param Composer $composer
* @param IOInterface $io
*/
public function activate(Composer $composer, IOInterface $io) {
$this->composer = $composer;
$this->io = $io;
$this->eventDispatcher = $composer->getEventDispatcher();
$this->executor = new ProcessExecutor($this->io);
$this->patches = array();
$this->installedPatches = array();
}
/**
* Returns an array of event names this subscriber wants to listen to.
*/
public static function getSubscribedEvents() {
return array(
ScriptEvents::PRE_INSTALL_CMD => "checkPatches",
ScriptEvents::PRE_UPDATE_CMD => "checkPatches",
PackageEvents::PRE_PACKAGE_INSTALL => "gatherPatches",
PackageEvents::PRE_PACKAGE_UPDATE => "gatherPatches",
PackageEvents::POST_PACKAGE_INSTALL => "postInstall",
PackageEvents::POST_PACKAGE_UPDATE => "postInstall",
);
}
/**
* Before running composer install,
* @param Event $event
*/
public function checkPatches(Event $event) {
if (!$this->isPatchingEnabled()) {
return;
}
try {
$repositoryManager = $this->composer->getRepositoryManager();
$localRepository = $repositoryManager->getLocalRepository();
$installationManager = $this->composer->getInstallationManager();
$packages = $localRepository->getPackages();
$tmp_patches = $this->grabPatches();
if ($tmp_patches == FALSE) {
$this->io->write('<info>No patches supplied.</info>');
return;
}
foreach ($packages as $package) {
$extra = $package->getExtra();
if (isset($extra['patches'])) {
$this->installedPatches[$package->getName()] = $extra['patches'];
}
$patches = isset($extra['patches']) ? $extra['patches'] : array();
$tmp_patches = array_merge_recursive($tmp_patches, $patches);
}
// Remove packages for which the patch set has changed.
foreach ($packages as $package) {
if (!($package instanceof AliasPackage)) {
$package_name = $package->getName();
$extra = $package->getExtra();
$has_patches = isset($tmp_patches[$package_name]);
$has_applied_patches = isset($extra['patches_applied']);
if (($has_patches && !$has_applied_patches)
|| (!$has_patches && $has_applied_patches)
|| ($has_patches && $has_applied_patches && $tmp_patches[$package_name] !== $extra['patches_applied'])) {
$uninstallOperation = new UninstallOperation($package, 'Removing package so it can be re-installed and re-patched.');
$this->io->write('<info>Removing package ' . $package_name . ' so that it can be re-installed and re-patched.</info>');
$installationManager->uninstall($localRepository, $uninstallOperation);
}
}
}
}
// If the Locker isn't available, then we don't need to do this.
// It's the first time packages have been installed.
catch (\LogicException $e) {
return;
}
}
/**
* Gather patches from dependencies and store them for later use.
*
* @param PackageEvent $event
*/
public function gatherPatches(PackageEvent $event) {
// If we've already done this, then don't do it again.
if (isset($this->patches['_patchesGathered'])) {
$this->io->write('<info>Patches already gathered. Skipping</info>', TRUE, IOInterface::VERBOSE);
return;
}
// If patching has been disabled, bail out here.
elseif (!$this->isPatchingEnabled()) {
$this->io->write('<info>Patching is disabled. Skipping.</info>', TRUE, IOInterface::VERBOSE);
return;
}
$this->patches = $this->grabPatches();
if (empty($this->patches)) {
$this->io->write('<info>No patches supplied.</info>');
}
$extra = $this->composer->getPackage()->getExtra();
$patches_ignore = isset($extra['patches-ignore']) ? $extra['patches-ignore'] : array();
// Now add all the patches from dependencies that will be installed.
$operations = $event->getOperations();
$this->io->write('<info>Gathering patches for dependencies. This might take a minute.</info>');
foreach ($operations as $operation) {
if ($operation->getJobType() == 'install' || $operation->getJobType() == 'update') {
$package = $this->getPackageFromOperation($operation);
$extra = $package->getExtra();
if (isset($extra['patches'])) {
if (isset($patches_ignore[$package->getName()])) {
foreach ($patches_ignore[$package->getName()] as $package_name => $patches) {
if (isset($extra['patches'][$package_name])) {
$extra['patches'][$package_name] = array_diff($extra['patches'][$package_name], $patches);
}
}
}
$this->patches = $this->arrayMergeRecursiveDistinct($this->patches, $extra['patches']);
}
// Unset installed patches for this package
if(isset($this->installedPatches[$package->getName()])) {
unset($this->installedPatches[$package->getName()]);
}
}
}
// Merge installed patches from dependencies that did not receive an update.
foreach ($this->installedPatches as $patches) {
$this->patches = array_merge_recursive($this->patches, $patches);
}
// If we're in verbose mode, list the projects we're going to patch.
if ($this->io->isVerbose()) {
foreach ($this->patches as $package => $patches) {
$number = count($patches);
$this->io->write('<info>Found ' . $number . ' patches for ' . $package . '.</info>');
}
}
// Make sure we don't gather patches again. Extra keys in $this->patches
// won't hurt anything, so we'll just stash it there.
$this->patches['_patchesGathered'] = TRUE;
}
/**
* Get the patches from root composer or external file
* @return Patches
* @throws \Exception
*/
public function grabPatches() {
// First, try to get the patches from the root composer.json.
$extra = $this->composer->getPackage()->getExtra();
if (isset($extra['patches'])) {
$this->io->write('<info>Gathering patches for root package.</info>');
$patches = $extra['patches'];
return $patches;
}
// If it's not specified there, look for a patches-file definition.
elseif (isset($extra['patches-file'])) {
$this->io->write('<info>Gathering patches from patch file.</info>');
$patches = file_get_contents($extra['patches-file']);
$patches = json_decode($patches, TRUE);
$error = json_last_error();
if ($error != 0) {
switch ($error) {
case JSON_ERROR_DEPTH:
$msg = ' - Maximum stack depth exceeded';
break;
case JSON_ERROR_STATE_MISMATCH:
$msg = ' - Underflow or the modes mismatch';
break;
case JSON_ERROR_CTRL_CHAR:
$msg = ' - Unexpected control character found';
break;
case JSON_ERROR_SYNTAX:
$msg = ' - Syntax error, malformed JSON';
break;
case JSON_ERROR_UTF8:
$msg = ' - Malformed UTF-8 characters, possibly incorrectly encoded';
break;
default:
$msg = ' - Unknown error';
break;
}
throw new \Exception('There was an error in the supplied patches file:' . $msg);
}
if (isset($patches['patches'])) {
$patches = $patches['patches'];
return $patches;
}
elseif(!$patches) {
throw new \Exception('There was an error in the supplied patch file');
}
}
else {
return array();
}
}
/**
* @param PackageEvent $event
* @throws \Exception
*/
public function postInstall(PackageEvent $event) {
// Get the package object for the current operation.
$operation = $event->getOperation();
/** @var PackageInterface $package */
$package = $this->getPackageFromOperation($operation);
$package_name = $package->getName();
if (!isset($this->patches[$package_name])) {
if ($this->io->isVerbose()) {
$this->io->write('<info>No patches found for ' . $package_name . '.</info>');
}
return;
}
$this->io->write(' - Applying patches for <info>' . $package_name . '</info>');
// Get the install path from the package object.
$manager = $event->getComposer()->getInstallationManager();
$install_path = $manager->getInstaller($package->getType())->getInstallPath($package);
// Set up a downloader.
$downloader = new RemoteFilesystem($this->io, $this->composer->getConfig());
// Track applied patches in the package info in installed.json
$localRepository = $this->composer->getRepositoryManager()->getLocalRepository();
$localPackage = $localRepository->findPackage($package_name, $package->getVersion());
$extra = $localPackage->getExtra();
$extra['patches_applied'] = array();
foreach ($this->patches[$package_name] as $description => $url) {
$this->io->write(' <info>' . $url . '</info> (<comment>' . $description. '</comment>)');
try {
$this->eventDispatcher->dispatch(NULL, new PatchEvent(PatchEvents::PRE_PATCH_APPLY, $package, $url, $description));
$this->getAndApplyPatch($downloader, $install_path, $url);
$this->eventDispatcher->dispatch(NULL, new PatchEvent(PatchEvents::POST_PATCH_APPLY, $package, $url, $description));
$extra['patches_applied'][$description] = $url;
}
catch (\Exception $e) {
$this->io->write(' <error>Could not apply patch! Skipping. The error was: ' . $e->getMessage() . '</error>');
$extra = $this->composer->getPackage()->getExtra();
if (getenv('COMPOSER_EXIT_ON_PATCH_FAILURE') || !empty($extra['composer-exit-on-patch-failure'])) {
throw new \Exception("Cannot apply patch $description ($url)!");
}
}
}
$localPackage->setExtra($extra);
$this->io->write('');
$this->writePatchReport($this->patches[$package_name], $install_path);
}
/**
* Get a Package object from an OperationInterface object.
*
* @param OperationInterface $operation
* @return PackageInterface
* @throws \Exception
*/
protected function getPackageFromOperation(OperationInterface $operation) {
if ($operation instanceof InstallOperation) {
$package = $operation->getPackage();
}
elseif ($operation instanceof UpdateOperation) {
$package = $operation->getTargetPackage();
}
else {
throw new \Exception('Unknown operation: ' . get_class($operation));
}
return $package;
}
/**
* Apply a patch on code in the specified directory.
*
* @param RemoteFilesystem $downloader
* @param $install_path
* @param $patch_url
* @throws \Exception
*/
protected function getAndApplyPatch(RemoteFilesystem $downloader, $install_path, $patch_url) {
// Local patch file.
if (file_exists($patch_url)) {
$filename = realpath($patch_url);
}
else {
// Generate random (but not cryptographically so) filename.
$filename = uniqid(sys_get_temp_dir().'/') . ".patch";
// Download file from remote filesystem to this location.
$hostname = parse_url($patch_url, PHP_URL_HOST);
$downloader->copy($hostname, $patch_url, $filename, FALSE);
}
// Modified from drush6:make.project.inc
$patched = FALSE;
// The order here is intentional. p1 is most likely to apply with git apply.
// p0 is next likely. p2 is extremely unlikely, but for some special cases,
// it might be useful.
$patch_levels = array('-p1', '-p0', '-p2');
foreach ($patch_levels as $patch_level) {
$checked = $this->executeCommand('cd %s && git --git-dir=. apply --check %s %s', $install_path, $patch_level, $filename);
if ($checked) {
// Apply the first successful style.
$patched = $this->executeCommand('cd %s && git --git-dir=. apply %s %s', $install_path, $patch_level, $filename);
break;
}
}
// In some rare cases, git will fail to apply a patch, fallback to using
// the 'patch' command.
if (!$patched) {
foreach ($patch_levels as $patch_level) {
// --no-backup-if-mismatch here is a hack that fixes some
// differences between how patch works on windows and unix.
if ($patched = $this->executeCommand("patch %s --no-backup-if-mismatch -d %s < %s", $patch_level, $install_path, $filename)) {
break;
}
}
}
// Clean up the temporary patch file.
if (isset($hostname)) {
unlink($filename);
}
// If the patch *still* isn't applied, then give up and throw an Exception.
// Otherwise, let the user know it worked.
if (!$patched) {
throw new \Exception("Cannot apply patch $patch_url");
}
}
/**
* Checks if the root package enables patching.
*
* @return bool
* Whether patching is enabled. Defaults to TRUE.
*/
protected function isPatchingEnabled() {
$extra = $this->composer->getPackage()->getExtra();
if (empty($extra['patches']) && empty($extra['patches-ignore']) && !isset($extra['patches-file'])) {
// The root package has no patches of its own, so only allow patching if
// it has specifically opted in.
return isset($extra['enable-patching']) ? $extra['enable-patching'] : FALSE;
}
else {
return TRUE;
}
}
/**
* Writes a patch report to the target directory.
*
* @param array $patches
* @param string $directory
*/
protected function writePatchReport($patches, $directory) {
$output = "This file was automatically generated by Composer Patches (https://github.com/cweagans/composer-patches)\n";
$output .= "Patches applied to this directory:\n\n";
foreach ($patches as $description => $url) {
$output .= $description . "\n";
$output .= 'Source: ' . $url . "\n\n\n";
}
file_put_contents($directory . "/PATCHES.txt", $output);
}
/**
* Executes a shell command with escaping.
*
* @param string $cmd
* @return bool
*/
protected function executeCommand($cmd) {
// Shell-escape all arguments except the command.
$args = func_get_args();
foreach ($args as $index => $arg) {
if ($index !== 0) {
$args[$index] = escapeshellarg($arg);
}
}
// And replace the arguments.
$command = call_user_func_array('sprintf', $args);
$output = '';
if ($this->io->isVerbose()) {
$this->io->write('<comment>' . $command . '</comment>');
$io = $this->io;
$output = function ($type, $data) use ($io) {
if ($type == Process::ERR) {
$io->write('<error>' . $data . '</error>');
}
else {
$io->write('<comment>' . $data . '</comment>');
}
};
}
return ($this->executor->execute($command, $output) == 0);
}
/**
* Recursively merge arrays without changing data types of values.
*
* Does not change the data types of the values in the arrays. Matching keys'
* values in the second array overwrite those in the first array, as is the
* case with array_merge.
*
* @param array $array1
* The first array.
* @param array $array2
* The second array.
* @return array
* The merged array.
*
* @see http://php.net/manual/en/function.array-merge-recursive.php#92195
*/
protected function arrayMergeRecursiveDistinct(array $array1, array $array2) {
$merged = $array1;
foreach ($array2 as $key => &$value) {
if (is_array($value) && isset($merged[$key]) && is_array($merged[$key])) {
$merged[$key] = $this->arrayMergeRecursiveDistinct($merged[$key], $value);
}
else {
$merged[$key] = $value;
}
}
return $merged;
}
}

163
vendor/vgrem/php-spo/.gitignore поставляемый
Просмотреть файл

@ -1,163 +0,0 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# User-specific files
*.suo
*.user
*.sln.docstates
# Build results
[Dd]ebug/
[Rr]elease/
x64/
build/
[Bb]in/
[Oo]bj/
# Enable "build/" folder in the NuGet Packages folder since NuGet packages use it for MSBuild targets
!packages/*/build/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
*_i.c
*_p.c
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.scc
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opensdf
*.sdf
*.cachefile
# Visual Studio profiler
*.psess
*.vsp
*.vspx
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# NCrunch
*.ncrunch*
.*crunch*.local.xml
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.Publish.xml
# NuGet Packages Directory
## TODO: If you have NuGet Package Restore enabled, uncomment the next line
#packages/
# Windows Azure Build Output
csx
*.build.csdef
# Windows Store app package directory
AppPackages/
# Others
sql/
*.Cache
ClientBin/
[Ss]tyle[Cc]op.*
~$*
*~
*.dbmdl
*.[Pp]ublish.xml
*.pfx
*.publishsettings
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file to a newer
# Visual Studio version. Backup files are not needed, because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
# SQL Server files
App_Data/*.mdf
App_Data/*.ldf
#LightSwitch generated files
GeneratedArtifacts/
_Pvt_Extensions/
ModelManifest.xml
# =========================
# Windows detritus
# =========================
# Windows image file caches
Thumbs.db
ehthumbs.db
# Folder config file
Desktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Mac desktop service store files
.DS_Store
*.phpproj
*.sln
.idea/
examples/SharePoint/todoapp/
src/ExcelServices/
src/SharePoint/DocumentManagement/Video/
examples/GraphExplorer/bower_components
vendor

37
vendor/vgrem/php-spo/.travis.yml поставляемый
Просмотреть файл

@ -1,37 +0,0 @@
language: php
# list any PHP version you want to test against
php:
# using major version aliases
# aliased to a recent 5.4.x version
- 5.4
# aliased to a recent 5.5.x version
- 5.5
# aliased to a recent 5.6.x version
- 5.6
# aliased to a recent 7.x version
- 7.0
# aliased to a recent hhvm version
- hhvm
# optionally set up exclutions and allowed failures in the matrix
matrix:
exclude:
- php: 5.5
- php: 5.6
- php: 7.0
allow_failures:
- php: hhvm
before_script:
- composer self-update
- composer install --prefer-source --no-interaction --dev
# omitting "script:" will default to phpunit
script:
- phpunit --configuration phpunit_o365.xml --coverage-text
notifications:
email: never

21
vendor/vgrem/php-spo/LICENSE.md поставляемый
Просмотреть файл

@ -1,21 +0,0 @@
The MIT License (MIT)
Copyright (c) 2016 Vadim Gremyachev
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

182
vendor/vgrem/php-spo/README.md поставляемый
Просмотреть файл

@ -1,182 +0,0 @@
### About
The library provides a Office 365 REST client for PHP applications. It allows to performs CRUD operations against Office 365 resources via an REST/OData based API.
#### The list of supported Office 365 REST APIs:
- [SharePoint REST API](https://msdn.microsoft.com/en-us/library/office/jj860569.aspx) (_supported_ versions: [SharePoint 2013](https://msdn.microsoft.com/library/office/jj860569(v=office.15).aspx), SharePoint 2016, SharePoint Online and OneDrive for Business)
- [Outlook REST API](https://msdn.microsoft.com/en-us/office/office365/api/use-outlook-rest-api#DefineOutlookRESTAPI)
- [Outlook Contacts REST API](https://msdn.microsoft.com/en-us/office/office365/api/contacts-rest-operations)
- [Outlook Calendar REST API](https://msdn.microsoft.com/en-us/office/office365/api/calendar-rest-operations)
- [Outlook Mail REST API](https://msdn.microsoft.com/en-us/office/office365/api/mail-rest-operations)
- OneNote REST API
### Status
[![Build Status](https://travis-ci.org/vgrem/phpSPO.svg?branch=master)](https://travis-ci.org/vgrem/phpSPO)
### Installation
You can use **Composer** or simply **Download the Release**
#### Composer
The preferred method is via [composer](https://getcomposer.org). Follow the
[installation instructions](https://getcomposer.org/doc/00-intro.md) if you do not already have
composer installed.
Once composer is installed, execute the following command in your project root to install this library:
```sh
composer require vgrem/php-spo:dev-master -n --no-progress
```
Finally, be sure to include the autoloader:
```php
require_once '/path/to/your-project/vendor/autoload.php';
```
### PHP version
- [PHP 5.4 or later](https://secure.php.net/)
### API
- PHP:cURL underlying library is used to perform HTTP requests
- `ClientContext` - represents a SharePoint client context to performs CRUD operations against SharePoint resources via SharePoint Online REST API
- `OutlookClient` - represents a client context to performs CRUD operations against Office resources such as Outlook resources
- `ClientRequest` - represents a client request (more low level compared to `ClientContext`) to to performs CRUD operations against SharePoint resources via SharePoint Online REST API
- `AuthenticationContext` - represents an object that provides credentials to access SharePoint Online resources.
- `NetworkCredentialContext` - provides credentials for password-based authentication schemes such as Basic.
There are **two** approaches available to perform REST based queries:
- via `ClientRequest` class where you need to construct REST queries by specifying endpoint url, headers if required and payload (low level approach), see [renameFolder.php](https://github.com/vgrem/phpSPO/blob/master/examples/renameFolder.php) for a more details
- via `ClientContext` class where you target client object resources such as Web, ListItem and etc., see [list_examples.php](https://github.com/vgrem/phpSPO/blob/master/examples/list_examples.php) for a more details
### Usage
#### Using SharePoint REST API
The following examples demonstrates how to perform basic CRUD operations against **SharePoint** list item resources.
Example 1. How to read SharePoint list items
````
$authCtx = new AuthenticationContext($Url);
$authCtx->acquireTokenForUser($UserName,$Password); //authenticate
$ctx = new ClientContext($Url,$authCtx); //initialize REST client
$web = $ctx->getWeb();
$list = $web->getLists()->getByTitle($listTitle); //init List resource
$items = $list->getItems(); //prepare a query to retrieve from the
$ctx->load($items); //save a query to retrieve list items from the server
$ctx->executeQuery(); //submit query to SharePoint Online REST service
foreach( $items->getData() as $item ) {
print "Task: '{$item->Title}'\r\n";
}
````
Example 2. How to create SharePoint list item:
````
$listTitle = 'Tasks';
$list = $ctx->getWeb()->getLists()->getByTitle($listTitle);
$itemProperties = array('Title' => 'Order Approval', 'Body' => 'Order approval task','__metadata' => array('type' => 'SP.Data.TasksListItem'));
$item = $list->addItem($itemProperties);
$ctx->executeQuery();
print "Task '{$item->Title}' has been created.\r\n";
````
Example 3. How to delete a SharePoint list item:
````
$listTitle = 'Tasks';
$itemToDeleteId = 1;
$list = $ctx->getWeb()->getLists()->getByTitle($listTitle);
$listItem = $list->getItemById($itemToDeleteId);
$listItem->deleteObject();
$ctx->executeQuery();
````
Example 4. How to update SharePoint list item:
````
$listTitle = 'Tasks';
$itemToUpdateId = 1;
$list = $ctx->getWeb()->getLists()->getByTitle($listTitle);
$listItem = $list->getItemById($itemId);
$itemProperties = array('PercentComplete' => 1);
$listItem->update($itemProperties);
$ctx->executeQuery();
````
#### Using Outlook REST API
The following examples demonstrates how to read, create and send messages via Outlook Mail API.
Example 1. How to create a draft message
````
$authCtx = new NetworkCredentialContext($UserName,$Password); //using Basic Auth scheme (for v1 API only)
$ctx = new OutlookClient($authCtx); //initialize OutlookServices client
$message = $ctx->getMe()->getMessages()->createMessage(); //create a Message resource
//set Message properties
$message->Subject = "--subject--";
$message->Body = new ItemBody(BodyType::Text,"--Content goes here--");
$message->ToRecipients = array(
new Recipient(new EmailAddress("Jon Doe","jdoe@contoso.onmicrosoft.com"))
);
$ctx->executeQuery();
````
Example 2. How to get messages
````
$authCtx = new NetworkCredentialContext($UserName,$Password); //using Basic Auth scheme (for v1 API only)
$ctx = new OutlookClient($authCtx); //initialize OutlookServices client
$messages = $ctx->getMe()->getMessages();
$ctx->load($messages);
$ctx->executeQuery();
//print messages subjects
foreach ($messages->getData() as $curMessage){
print $curMessage->Subject;
}
````
Example 3. How to send a message
````
$authCtx = new NetworkCredentialContext($UserName,$Password); //using Basic Auth scheme (for v1 API only)
$ctx = new OutlookClient($authCtx); //initialize OutlookServices client
$message = $ctx->getMe()->getMessages()->createMessage(); //create a Message resource
//set Message properties
$message->Subject = "--subject--";
$message->Body = new ItemBody(BodyType::Text,"--Content goes here--");
$message->ToRecipients = array(
new Recipient(new EmailAddress("Jon Doe","jdoe@contoso.onmicrosoft.com"))
);
$ctx->getMe()->sendEmail($message,false); //send a Message
$ctx->executeQuery();
````
## Changelog
1.0.0 - May 23st, 2014
- Initial release.
2.0.0 - February 14, 2016
- `AuthenticationContext` and `ClientContext` classes have been introduced.

23
vendor/vgrem/php-spo/composer.json поставляемый
Просмотреть файл

@ -1,23 +0,0 @@
{
"name": "vgrem/php-spo",
"description": "The library provides a Office 365 REST client for PHP. It allows to performs CRUD operations against Office 365 resources via an REST/OData based API",
"type": "library",
"keywords": ["sharepoint", "office365", "rest", "curl", "api"],
"authors": [
{
"name": "Vadim Gremyachev",
"email": "vvgrem@gmail.com"
}
],
"license": "LGPL-3.0+",
"minimum-stability": "dev",
"require": {
"php": ">=5.4",
"ext-curl": "*"
},
"autoload": {
"psr-4": {
"Office365\\PHP\\Client\\": "src/"
}
}
}

21
vendor/vgrem/php-spo/composer.lock сгенерированный поставляемый
Просмотреть файл

@ -1,21 +0,0 @@
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"hash": "ad2d01946ac5c59009ce7386f5f2d284",
"content-hash": "c008500d1e4985f2a38587abd0cad43c",
"packages": [],
"packages-dev": [],
"aliases": [],
"minimum-stability": "dev",
"stability-flags": [],
"prefer-stable": false,
"prefer-lowest": false,
"platform": {
"php": ">=5.4",
"ext-curl": "*"
},
"platform-dev": []
}

24
vendor/vgrem/php-spo/phpunit_o365.xml поставляемый
Просмотреть файл

@ -1,24 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="tests/bootstrap.php" colors="true">
<!--php>
<var name="Url" value="https://contoso.sharepoint.com/"/>
<var name="UserName" value=""/>
<var name="Password" value=""/>
</php-->
<testsuites>
<testsuite name="SharePoint REST client for PHP Test Suite">
<directory>./tests/</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory>./</directory>
<exclude>
<directory>./tests</directory>
</exclude>
</whitelist>
</filter>
</phpunit>

Просмотреть файл

@ -1,33 +0,0 @@
<?php
namespace Office365\PHP\Client\Discovery;
use Office365\PHP\Client\Runtime\Auth\IAuthenticationContext;
use Office365\PHP\Client\Runtime\ClientActionReadEntity;
use Office365\PHP\Client\Runtime\ClientRuntimeContext;
use Office365\PHP\Client\Runtime\OData\JsonFormat;
use Office365\PHP\Client\Runtime\OData\ODataMetadataLevel;
use Office365\PHP\Client\Runtime\Office365Version;
class DiscoveryClient extends ClientRuntimeContext
{
public function __construct(IAuthenticationContext $authContext, $version = Office365Version::V1)
{
$serviceRootUrl = "https://api.office.com/discovery/$version/";
parent::__construct($serviceRootUrl, $authContext,new JsonFormat(ODataMetadataLevel::Verbose),$version);
}
/**
* @return ServiceInfoCollection
*/
public function getAllServices()
{
$allServices = new ServiceInfoCollection();
$qry = new ClientActionReadEntity($this->getServiceRootUrl() . "me/allServices");
$this->addQuery($qry,$allServices);
return $allServices;
}
}

Просмотреть файл

@ -1,14 +0,0 @@
<?php
namespace Office365\PHP\Client\Discovery;
use Office365\PHP\Client\Runtime\ClientValueObject;
class ServiceInfo extends ClientValueObject
{
}

Просмотреть файл

@ -1,13 +0,0 @@
<?php
namespace Office365\PHP\Client\Discovery;
use Office365\PHP\Client\Runtime\ClientValueObjectCollection;
class ServiceInfoCollection extends ClientValueObjectCollection
{
}

Просмотреть файл

@ -1,58 +0,0 @@
<?php
namespace Office365\PHP\Client\GraphClient;
use Office365\PHP\Client\Runtime\Auth\IAuthenticationContext;
use Office365\PHP\Client\Runtime\ClientAction;
use Office365\PHP\Client\Runtime\ClientRuntimeContext;
use Office365\PHP\Client\Runtime\OData\JsonLightFormat;
use Office365\PHP\Client\Runtime\OData\ODataMetadataLevel;
use Office365\PHP\Client\Runtime\ResourcePathEntity;
use Office365\PHP\Client\Runtime\Utilities\RequestOptions;
class ActiveDirectoryClient extends ClientRuntimeContext
{
public function __construct($serviceRoot,IAuthenticationContext $authContext)
{
parent::__construct($serviceRoot, $authContext,new JsonLightFormat(ODataMetadataLevel::Verbose));
}
public function executeQuery()
{
$this->getPendingRequest()->beforeExecuteQuery(function (RequestOptions $request,ClientAction $query){
$request->Url .= "?api-version=1.0";
});
parent::executeQuery();
}
public function getTenantDetails()
{
if(!isset($this->tenantDetails)){
$this->tenantDetails = new TenantDetailCollection($this,new ResourcePathEntity($this,null,"tenantDetails"));
}
return $this->tenantDetails;
}
public function getDevices()
{
if(!isset($this->devices)){
$this->devices = new DeviceCollection($this,new ResourcePathEntity($this,null,"devices"));
}
return $this->devices;
}
/**
* @var TenantDetailCollection $tenantDetails
*/
private $tenantDetails;
/**
* @var DeviceCollection $devices
*/
private $devices;
}

Просмотреть файл

@ -1,10 +0,0 @@
<?php
namespace Office365\PHP\Client\GraphClient;
class Contact extends DirectoryObject
{
}

Просмотреть файл

@ -1,12 +0,0 @@
<?php
namespace Office365\PHP\Client\GraphClient;
use Office365\PHP\Client\Runtime\ClientObjectCollection;
class ContactCollection extends ClientObjectCollection
{
}

Просмотреть файл

@ -1,10 +0,0 @@
<?php
namespace Office365\PHP\Client\GraphClient;
class Device extends DirectoryObject
{
}

Просмотреть файл

@ -1,11 +0,0 @@
<?php
namespace Office365\PHP\Client\GraphClient;
use Office365\PHP\Client\Runtime\ClientObjectCollection;
class DeviceCollection extends ClientObjectCollection
{
}

Просмотреть файл

@ -1,10 +0,0 @@
<?php
namespace Office365\PHP\Client\GraphClient;
class DirectoryObject extends GraphObject
{
}

Просмотреть файл

@ -1,11 +0,0 @@
<?php
namespace Office365\PHP\Client\GraphClient;
use Office365\PHP\Client\Runtime\ClientObjectCollection;
class DirectoryObjectCollection extends ClientObjectCollection
{
}

Просмотреть файл

@ -1,12 +0,0 @@
<?php
namespace Office365\PHP\Client\GraphClient;
use Office365\PHP\Client\Runtime\ClientObject;
class GraphObject extends ClientObject
{
}

Просмотреть файл

@ -1,10 +0,0 @@
<?php
namespace Office365\PHP\Client\GraphClient;
class TenantDetail extends DirectoryObject
{
}

Просмотреть файл

@ -1,12 +0,0 @@
<?php
namespace Office365\PHP\Client\GraphClient;
use Office365\PHP\Client\Runtime\ClientObjectCollection;
class TenantDetailCollection extends ClientObjectCollection
{
}

Просмотреть файл

@ -1,45 +0,0 @@
<?php
namespace Office365\PHP\Client\OneDrive;
use Office365\PHP\Client\Runtime\ClientObject;
use Office365\PHP\Client\Runtime\ResourcePathEntity;
class CurrentUserRequestContext extends ClientObject
{
/**
* @return Drive
*/
public function getDrive()
{
if (!$this->isPropertyAvailable("Drive")) {
$this->setProperty("Drive",
new Drive($this->getContext(), new ResourcePathEntity(
$this->getContext(),
$this->getResourcePath(),
"Drive"
)));
}
return $this->getProperty("Drive");
}
/**
* @return FileCollection
*/
public function getFiles()
{
if (!$this->isPropertyAvailable("Files")) {
$this->setProperty("Files",
new FileCollection($this->getContext(), new ResourcePathEntity(
$this->getContext(),
$this->getResourcePath(),
"Files"
)));
}
return $this->getProperty("Files");
}
}

55
vendor/vgrem/php-spo/src/OneDrive/Drive.php поставляемый
Просмотреть файл

@ -1,55 +0,0 @@
<?php
namespace Office365\PHP\Client\OneDrive;
use Office365\PHP\Client\Runtime\ClientObject;
use Office365\PHP\Client\Runtime\ResourcePathEntity;
class Drive extends ClientObject
{
/**
* Gets the user account that owns the drive.
* @return Identity
*/
public function getOwner(){
return $this->getProperty("owner");
}
/**
* Sets the user account that owns the drive.
* @param string $value
*/
public function setOwner($value){
return $this->setProperty("owner",$value);
}
/**
* @return ItemCollection
*/
public function getFiles(){
if (!$this->isPropertyAvailable("files")) {
$this->setProperty("files",
new ItemCollection(
$this->getContext(),
new ResourcePathEntity($this->getContext(),$this->getResourcePath(),"files")
));
}
return $this->getProperty("files");
}
/**
* @param string $value
*/
public function setFiles($value){
return $this->setProperty("files",$value);
}
}

52
vendor/vgrem/php-spo/src/OneDrive/File.php поставляемый
Просмотреть файл

@ -1,52 +0,0 @@
<?php
namespace Office365\PHP\Client\OneDrive;
class File extends Item
{
/**
*
* @return string
*/
public function getContentUrl(){
return $this->getProperty("contentUrl");
}
/**
*
* @param string $value
*/
public function setContentUrl($value){
return $this->setProperty("contentUrl",$value);
}
/**
*
* @return ImageFacet
*/
public function getImage(){
return $this->getProperty("image");
}
/**
*
* @param ImageFacet $value
*/
public function setImage($value){
return $this->setProperty("image",$value);
}
function getEntityTypeName()
{
return "#Microsoft.FileServices.File";
}
}

Просмотреть файл

@ -1,10 +0,0 @@
<?php
namespace Office365\PHP\Client\OneDrive;
class FileCollection extends ItemCollection
{
}

30
vendor/vgrem/php-spo/src/OneDrive/Folder.php поставляемый
Просмотреть файл

@ -1,30 +0,0 @@
<?php
namespace Office365\PHP\Client\OneDrive;
class Folder extends Item
{
/**
*
* @return int
*/
public function getChildCount(){
return $this->getProperty("childCount");
}
/**
*
* @param int $value
*/
public function setChildCount($value){
return $this->setProperty("childCount",$value);
}
}

Просмотреть файл

@ -1,9 +0,0 @@
<?php
namespace Office365\PHP\Client\OneDrive;
class FolderCollection extends ItemCollection
{
}

Просмотреть файл

@ -1,12 +0,0 @@
<?php
namespace Office365\PHP\Client\OneDrive;
use Office365\PHP\Client\Runtime\ClientObject;
class Identity extends ClientObject
{
}

Просмотреть файл

@ -1,12 +0,0 @@
<?php
namespace Office365\PHP\Client\FileServices;
use Office365\PHP\Client\Runtime\ClientObject;
class IdentitySet extends ClientObject
{
}

Просмотреть файл

@ -1,12 +0,0 @@
<?php
namespace Office365\PHP\Client\FileServices;
use Office365\PHP\Client\Runtime\ClientObject;
class ImageFacet extends ClientObject
{
}

49
vendor/vgrem/php-spo/src/OneDrive/Item.php поставляемый
Просмотреть файл

@ -1,49 +0,0 @@
<?php
namespace Office365\PHP\Client\OneDrive;
use Office365\PHP\Client\Runtime\ClientObject;
class Item extends ClientObject
{
/**
*
* @return string
*/
public function getWebUrl(){
return $this->getProperty("webUrl");
}
/**
*
* @param string $value
*/
public function setWebUrl($value){
return $this->setProperty("webUrl",$value);
}
/**
*
* @return ItemCollection
*/
public function getChildren(){
return $this->getProperty("children");
}
/**
*
* @param ItemCollection $value
*/
public function setChildren($value){
return $this->setProperty("children",$value);
}
}

Просмотреть файл

@ -1,22 +0,0 @@
<?php
namespace Office365\PHP\Client\OneDrive;
use Office365\PHP\Client\Runtime\ClientAction;
use Office365\PHP\Client\Runtime\ClientActionType;
use Office365\PHP\Client\Runtime\ClientObjectCollection;
class ItemCollection extends ClientObjectCollection
{
function add($name,$type,$content){
$payload = new File($this->getContext());
//$payload->setContent($content);
$qry = new ClientAction($this->getResourceUrl() . "/add",$payload,ClientActionType::CreateEntity);
$this->getContext()->addQuery($qry);
}
}

Просмотреть файл

@ -1,12 +0,0 @@
<?php
namespace Office365\PHP\Client\FileServices;
use Office365\PHP\Client\Runtime\ClientObject;
class ItemReference extends ClientObject
{
}

Просмотреть файл

@ -1,47 +0,0 @@
<?php
namespace Office365\PHP\Client\OneDrive;
use Office365\PHP\Client\Runtime\Auth\IAuthenticationContext;
use Office365\PHP\Client\Runtime\ClientAction;
use Office365\PHP\Client\Runtime\ClientRuntimeContext;
use Office365\PHP\Client\Runtime\ContextWebInformation;
use Office365\PHP\Client\Runtime\OData\JsonFormat;
use Office365\PHP\Client\Runtime\OData\ODataMetadataLevel;
use Office365\PHP\Client\Runtime\Office365Version;
use Office365\PHP\Client\Runtime\ResourcePathEntity;
use Office365\PHP\Client\Runtime\Utilities\RequestOptions;
class OneDriveClient extends ClientRuntimeContext
{
public function __construct($authorityUrl,IAuthenticationContext $authContext)
{
$serviceRootUrl = $authorityUrl . "/_api/" . Office365Version::V1 . "/";
parent::__construct($serviceRootUrl, $authContext,new JsonFormat(ODataMetadataLevel::Verbose));
}
public function executeQuery()
{
$this->getPendingRequest()->beforeExecuteQuery(function (RequestOptions $request,ClientAction $query){
});
parent::executeQuery();
}
/**
* @return CurrentUserRequestContext
*/
public function getMe(){
if(!isset($this->me))
$this->me = new CurrentUserRequestContext($this,new ResourcePathEntity($this,null,"me"));
return $this->me;
}
}

Просмотреть файл

@ -1,25 +0,0 @@
<?php
namespace Office365\PHP\Client\OneDrive;
abstract class OneDriveErrorCode
{
const AccessDenied = 0;
const ActivityLimitReached = 1;
const GeneralException = 2;
const InvalidRange = 3;
const InvalidRequest = 4;
const ItemNotFound = 5;
const MalwareDetected = 6;
const NameAlreadyExists = 7;
const NotAllowed = 8;
const NotSupported = 9;
const ResourceModified = 10;
const ResyncRequired = 11;
const ServiceNotAvailable = 12;
const Timeout = 13;
const TooManyRedirects = 14;
const QuotaLimitReached = 15;
const Unauthenticated = 16;
}

30
vendor/vgrem/php-spo/src/OneNote/Me.php поставляемый
Просмотреть файл

@ -1,30 +0,0 @@
<?php
namespace Office365\PHP\Client\OneNote;
use Office365\PHP\Client\Runtime\ClientObject;
use Office365\PHP\Client\Runtime\ResourcePathEntity;
class Me extends ClientObject
{
/**
* @return Notes
*/
public function getNotes()
{
if (!$this->isPropertyAvailable("Notes")) {
$this->setProperty("Notes",
new Notes($this->getContext(), new ResourcePathEntity(
$this->getContext(),
$this->getResourcePath(),
"Notes"
)));
}
return $this->getProperty("Notes");
}
}

Просмотреть файл

@ -1,13 +0,0 @@
<?php
namespace Office365\PHP\Client\OneNote;
use Office365\PHP\Client\Runtime\ClientObject;
class MyOrganization extends ClientObject
{
}

47
vendor/vgrem/php-spo/src/OneNote/Notebook.php поставляемый
Просмотреть файл

@ -1,47 +0,0 @@
<?php
namespace Office365\PHP\Client\OneNote;
use Office365\PHP\Client\Runtime\ClientObject;
use Office365\PHP\Client\Runtime\ResourcePathEntity;
class Notebook extends ClientObject
{
/**
* @return UserRole
*/
public function getUserRole()
{
if (!$this->isPropertyAvailable("UserRole")) {
$this->setProperty("UserRole",
new UserRole($this->getContext(), new ResourcePathEntity(
$this->getContext(),
$this->getResourcePath(),
"UserRole"
)));
}
return $this->getProperty("UserRole");
}
/**
* @return NotebookLinks
*/
public function getNotebookLinks()
{
if (!$this->isPropertyAvailable("NotebookLinks")) {
$this->setProperty("NotebookLinks",
new NotebookLinks($this->getContext(), new ResourcePathEntity(
$this->getContext(),
$this->getResourcePath(),
"NotebookLinks"
)));
}
return $this->getProperty("NotebookLinks");
}
}

Просмотреть файл

@ -1,12 +0,0 @@
<?php
namespace Office365\PHP\Client\OneNote;
use Office365\PHP\Client\Runtime\ClientObjectCollection;
class NotebookLinks extends ClientObjectCollection
{
}

31
vendor/vgrem/php-spo/src/OneNote/Notes.php поставляемый
Просмотреть файл

@ -1,31 +0,0 @@
<?php
namespace Office365\PHP\Client\OneNote;
use Office365\PHP\Client\Runtime\ClientObjectCollection;
use Office365\PHP\Client\Runtime\ResourcePathEntity;
class Notes extends ClientObjectCollection
{
/**
* @return PageCollection
*/
public function getPages()
{
if (!$this->isPropertyAvailable("Pages")) {
$this->setProperty("Pages",
new PageCollection($this->getContext(), new ResourcePathEntity(
$this->getContext(),
$this->getResourcePath(),
"Pages"
)));
}
return $this->getProperty("Pages");
}
}

Просмотреть файл

@ -1,97 +0,0 @@
<?php
namespace Office365\PHP\Client\OneNote;
use Office365\PHP\Client\Runtime\Auth\IAuthenticationContext;
use Office365\PHP\Client\Runtime\ClientAction;
use Office365\PHP\Client\Runtime\ClientActionType;
use Office365\PHP\Client\Runtime\ClientRuntimeContext;
use Office365\PHP\Client\Runtime\HttpMethod;
use Office365\PHP\Client\Runtime\OData\JsonFormat;
use Office365\PHP\Client\Runtime\OData\ODataMetadataLevel;
use Office365\PHP\Client\Runtime\Office365Version;
use Office365\PHP\Client\Runtime\ResourcePathEntity;
use Office365\PHP\Client\Runtime\Utilities\RequestOptions;
class OneNoteClient extends ClientRuntimeContext
{
public function __construct(IAuthenticationContext $authContext, $version = Office365Version::V1)
{
$this->version = $version;
$this->serviceRootUrl = $this->serviceRootUrl . $version . "/";
parent::__construct($this->serviceRootUrl, $authContext, new JsonFormat(ODataMetadataLevel::NoMetadata), $version);
}
/**
* Submits query to OneNote REST/OData service
*/
public function executeQuery()
{
$this->getPendingRequest()->beforeExecuteQuery(function (RequestOptions $request,ClientAction $query){
$this->prepareOutlookServicesRequest($request,$query);
});
parent::executeQuery();
}
private function prepareOutlookServicesRequest(RequestOptions $request,ClientAction $query)
{
//set data modification headers
if ($query->ActionType == ClientActionType::UpdateEntity) {
$request->Method = HttpMethod::Patch;
} else if ($query->ActionType == ClientActionType::DeleteEntity) {
$request->Method = HttpMethod::Delete;
}
}
/**
* @return Me
*/
public function getMe(){
if(!isset($this->me))
$this->me = new Me($this,new ResourcePathEntity($this,null,"Me"));
return $this->me;
}
/**
* @return MyOrganization
*/
public function getMyOrganization(){
if(!isset($this->myOrg))
$this->myOrg = new MyOrganization($this,new ResourcePathEntity($this,null,"MyOrganization"));
return $this->myOrg;
}
/**
* @var Me
*/
private $me;
/**
* @var MyOrganization
*/
private $myOrg;
/**
* @var string
*/
private $serviceRootUrl = "https://www.onenote.com/api/";
/**
* @var string
*/
public $version;
}

12
vendor/vgrem/php-spo/src/OneNote/Page.php поставляемый
Просмотреть файл

@ -1,12 +0,0 @@
<?php
namespace Office365\PHP\Client\OneNote;
use Office365\PHP\Client\Runtime\ClientObject;
class Page extends ClientObject
{
}

Просмотреть файл

@ -1,12 +0,0 @@
<?php
namespace Office365\PHP\Client\OneNote;
use Office365\PHP\Client\Runtime\ClientObjectCollection;
class PageCollection extends ClientObjectCollection
{
}

Просмотреть файл

@ -1,11 +0,0 @@
<?php
namespace Office365\PHP\Client\OneNote;
use Office365\PHP\Client\Runtime\ClientObjectCollection;
class PageLinks extends ClientObjectCollection
{
}

Просмотреть файл

@ -1,14 +0,0 @@
<?php
namespace Office365\PHP\Client\OneNote;
class PatchActionType
{
const Replace = 0;
const Append = 1;
const Delete = 2;
const Insert = 3;
const Prepend = 4;
}

12
vendor/vgrem/php-spo/src/OneNote/Resource.php поставляемый
Просмотреть файл

@ -1,12 +0,0 @@
<?php
namespace Office365\PHP\Client\OneNote;
use Office365\PHP\Client\Runtime\ClientObject;
class Resource extends ClientObject
{
}

12
vendor/vgrem/php-spo/src/OneNote/Section.php поставляемый
Просмотреть файл

@ -1,12 +0,0 @@
<?php
namespace Office365\PHP\Client\OneNote;
use Office365\PHP\Client\Runtime\ClientObject;
class Section extends ClientObject
{
}

Просмотреть файл

@ -1,12 +0,0 @@
<?php
namespace Office365\PHP\Client\OneNote;
use Office365\PHP\Client\Runtime\ClientObject;
class SectionGroup extends ClientObject
{
}

11
vendor/vgrem/php-spo/src/OneNote/Site.php поставляемый
Просмотреть файл

@ -1,11 +0,0 @@
<?php
namespace Office365\PHP\Client\OneNote;
use Office365\PHP\Client\Runtime\ClientObject;
class Site extends ClientObject
{
}

Просмотреть файл

@ -1,12 +0,0 @@
<?php
namespace Office365\PHP\Client\OneNote;
use Office365\PHP\Client\Runtime\ClientObjectCollection;
class SiteCollection extends ClientObjectCollection
{
}

Просмотреть файл

@ -1,12 +0,0 @@
<?php
namespace Office365\PHP\Client\OneNote;
use Office365\PHP\Client\Runtime\ClientObject;
class SiteMetadata extends ClientObject
{
}

13
vendor/vgrem/php-spo/src/OneNote/UserRole.php поставляемый
Просмотреть файл

@ -1,13 +0,0 @@
<?php
namespace Office365\PHP\Client\OneNote;
class UserRole
{
const Owner = 0;
const Contributor = 1;
const Reader = 2;
const None = 3;
}

Просмотреть файл

@ -1,51 +0,0 @@
<?php
namespace Office365\PHP\Client\OutlookServices;
/**
* A file or item (contact, event or message) attached to an event or message.
*/
abstract class Attachment extends OutlookEntity
{
/**
* The MIME type of the attachment.
* @var string $ContentType
*/
public $ContentType;
/**
* true if the attachment is an inline attachment; otherwise, false.
* @var boolean $IsInline
*/
public $IsInline;
/**
* The date and time when the attachment was last modified.
* @var \DateTime $LastModifiedDateTime
*/
public $LastModifiedDateTime;
/**
* The display name of the attachment. This does not need to be the actual file name.
* @var string $Name
*/
public $Name;
/**
* The length of the attachment in bytes.
* @var int $Size
*/
public $Size;
public static function getType() {
return get_called_class();
}
}

Просмотреть файл

@ -1,12 +0,0 @@
<?php
namespace Office365\PHP\Client\OutlookServices;
use Office365\PHP\Client\Runtime\ClientObjectCollection;
class AttachmentCollection extends ClientObjectCollection
{
}

Просмотреть файл

@ -1,24 +0,0 @@
<?php
namespace Office365\PHP\Client\OutlookServices;
/**
* An event attendee.
*/
class Attendee extends Recipient
{
/**
* The response (none, accepted, declined, etc.) and time.
* @var ResponseStatus $Status
*/
public $Status;
/**
* The type of the attendee: Required = 0, Optional = 1, Resource = 2.
* @var string $Type
*/
public $Type;
}

Просмотреть файл

@ -1,12 +0,0 @@
<?php
namespace Office365\PHP\Client\OutlookServices;
class AttendeeType
{
const Required = "Required";
const Optional = "Optional";
const Resource = "Resource";
}

Просмотреть файл

@ -1,15 +0,0 @@
<?php
namespace Office365\PHP\Client\OutlookServices;
use Office365\PHP\Client\Runtime\Utilities\EnumType;
class BodyType extends EnumType
{
const Text = "Text";
const HTML = "HTML";
}

Просмотреть файл

@ -1,59 +0,0 @@
<?php
namespace Office365\PHP\Client\OutlookServices;
use DateTime;
use Office365\PHP\Client\Runtime\ClientActionReadEntity;
use Office365\PHP\Client\Runtime\ResourcePathEntity;
/**
* A calendar which is a container for events.
*/
class Calendar extends OutlookEntity
{
/**
* @param \DateTime $startDateTime
* @param \DateTime $endDateTime
* @return EventCollection
*/
public function getCalendarView($startDateTime, $endDateTime)
{
$url = "CalendarView?startDateTime=" . rawurlencode($startDateTime->format(DateTime::ISO8601))
. "&endDateTime=" . rawurlencode($endDateTime->format(DateTime::W3C));
$events = new EventCollection(
$this->getContext(),
new ResourcePathEntity($this->getContext(),$this->getResourcePath(),$url)
);
$qry = new ClientActionReadEntity($events->getResourceUrl());
$this->getContext()->addQuery($qry,$events);
return $events;
}
/**
* The calendar name.
* @var string
*/
public $Name;
/**
* Specifies the color theme to distinguish the calendar from other calendars in a UI.
* @var int
*/
public $Color;
/**
* The calendar view for the calendar. Navigation property.
* @var array
*/
public $CalendarView;
/**
* The events in the calendar. Navigation property.
* @var array
*/
public $Events;
}

Просмотреть файл

@ -1,12 +0,0 @@
<?php
namespace Office365\PHP\Client\OutlookServices;
use Office365\PHP\Client\Runtime\ClientObjectCollection;
class CalendarCollection extends ClientObjectCollection
{
}

Просмотреть файл

@ -1,20 +0,0 @@
<?php
namespace Office365\PHP\Client\OutlookServices;
class CalendarColor
{
const Auto = -1;
const LightBlue = 0;
const LightGreen = 1;
const LightOrange = 2;
const LightGray = 3;
const LightYellow = 4;
const LightTeal = 5;
const LightPink = 6;
const LightBrown = 7;
const LightRed = 8;
const MaxColor = 9;
}

Просмотреть файл

@ -1,13 +0,0 @@
<?php
namespace Office365\PHP\Client\OutlookServices;
/**
* A group of calendars.
*/
class CalendarGroup extends OutlookEntity
{
}

Просмотреть файл

@ -1,11 +0,0 @@
<?php
namespace Office365\PHP\Client\OutlookServices;
use Office365\PHP\Client\Runtime\ClientObjectCollection;
class CalendarGroupCollection extends ClientObjectCollection
{
}

Просмотреть файл

@ -1,14 +0,0 @@
<?php
namespace Office365\PHP\Client\OutlookServices;
class ChangeType
{
const Created = 1;
const Updated = 2;
const Deleted = 4;
const Acknowledgment = 8;
const Missed = 16;
}

Просмотреть файл

@ -1,131 +0,0 @@
<?php
namespace Office365\PHP\Client\OutlookServices;
/**
* A contact, which is an item in Outlook for users to organize and save information about the people and organizations
* that they communicate with. Contacts are contained in contact folders.
*/
class Contact extends Item
{
/**
* The name of the contact's assistant.
* @var string
*/
public $AssistantName;
/**
* The ID of the contact's parent folder.
* @var string
*/
public $ParentFolderId;
/**
* The contact's birthday.
* @var string
*/
public $Birthday;
/**
* The contact's given name.
* @var string
*/
public $GivenName;
/**
* The contact's initials.
* @var string
*/
public $Initials;
/**
* The contact's surname.
* @var string
*/
public $Surname;
/**
* The contact's job title.
* @var string
*/
public $JobTitle;
/**
* @var string
*/
public $Department;
/**
* @var array
*/
public $BusinessPhones;
/**
* @var string
*/
public $MobilePhone1;
/**
* The contact's email addresses.
* @var array
*/
public $EmailAddresses;
/**
* The contact's generation.
* @var string
*/
public $Generation;
/**
* The contact's home address.
* @var PhysicalAddress
*/
public $HomeAddress;
/**
* @var array
*/
public $HomePhones;
/**
* The contact's instant messaging (IM) addresses.
* @var array
*/
public $ImAddresses;
/**
* The name of the contact's manager.
* @var string
*/
public $Manager;
/**
* The contact's middle name.
* @var string
*/
public $MiddleName;
/**
* The contact's nickname.
* @var string
*/
public $NickName;
}

Просмотреть файл

@ -1,39 +0,0 @@
<?php
namespace Office365\PHP\Client\OutlookServices;
use Office365\PHP\Client\Runtime\ClientActionCreateEntity;
use Office365\PHP\Client\Runtime\ClientObjectCollection;
use Office365\PHP\Client\Runtime\ResourcePathEntity;
class ContactCollection extends ClientObjectCollection
{
/**
* Creates Contact resource
* @return Contact
*/
public function createContact() {
$contact = new Contact($this->getContext());
$qry = new ClientActionCreateEntity($this, $contact);
$this->getContext()->addQuery($qry, $contact);
$this->addChild($contact);
return $contact;
}
/**
* Get a contact by using the contact ID.
* @param string $contactId
* @return Contact
*/
function getById($contactId){
return new Contact(
$this->getContext(),
new ResourcePathEntity($this->getContext(),$this->getResourcePath(),$contactId)
);
}
}

Просмотреть файл

@ -1,41 +0,0 @@
<?php
namespace Office365\PHP\Client\OutlookServices;
/**
* A folder that contains contacts.
* @package Office365\PHP\Client\OutlookServices
*/
class ContactFolder extends OutlookEntity
{
/**
* The collection of child folders in the folder. Navigation property.
* @var array
*/
public $ChildFolders;
/**
* The contacts in the folder. Navigation property.
* @var array
*/
public $Contacts;
/**
* The folder's display name.
* @var string
*/
public $DisplayName;
/**
* The ID of the folder's parent folder.
* @var string
*/
public $ParentFolderId;
}

Просмотреть файл

@ -1,12 +0,0 @@
<?php
namespace Office365\PHP\Client\OutlookServices;
/**
* Class Conversation
*/
class Conversation extends OutlookEntity
{
}

Просмотреть файл

@ -1,11 +0,0 @@
<?php
namespace Office365\PHP\Client\OutlookServices;
use Office365\PHP\Client\Runtime\ClientObjectCollection;
class ConversationCollection extends ClientObjectCollection
{
}

Просмотреть файл

@ -1,10 +0,0 @@
<?php
namespace Office365\PHP\Client\OutlookServices;
class ConversationThread extends OutlookEntity
{
}

Просмотреть файл

@ -1,15 +0,0 @@
<?php
namespace Office365\PHP\Client\OutlookServices;
use Office365\PHP\Client\Runtime\ClientValueObject;
/**
* Describes the date, time, and time zone of a point in time.
*/
class DateTimeTimeZone extends ClientValueObject
{
}

Просмотреть файл

@ -1,16 +0,0 @@
<?php
namespace Office365\PHP\Client\OutlookServices;
class DayOfWeek
{
const Sunday = 0;
const Monday = 1;
const Tuesday = 2;
const Wednesday = 3;
const Thursday = 4;
const Friday = 5;
const Saturday = 6;
}

Просмотреть файл

@ -1,37 +0,0 @@
<?php
namespace Office365\PHP\Client\OutlookServices;
use Office365\PHP\Client\Runtime\ClientValueObject;
/**
* The name and email address of a contact or message recipient.
*/
class EmailAddress extends ClientValueObject
{
/**
* EmailAddress constructor.
* @param string $typeName
* @param string $address
*/
public function __construct($typeName, $address)
{
$this->Name = $typeName;
$this->Address = $address;
parent::__construct();
}
/**
* The display name of the person or entity.
* @var string
*/
public $Name;
/**
* The email address of the person or entity.
* @var string
*/
public $Address;
}

Просмотреть файл

@ -1,66 +0,0 @@
<?php
namespace Office365\PHP\Client\OutlookServices;
/**
* An event in a calendar.
*/
class Event extends Item
{
/**
* @var string
*/
public $Subject;
/**
* The body of the message associated with the event.
* @var ItemBody
*/
public $Body;
/**
* The collection of attendees for the event.
* @var array
*/
public $Attendees;
/**
* The location of the event.
* @var Location
*/
public $Location;
/**
* The status to show: Free = 0, Tentative = 1, Busy = 2, Oof = 3, WorkingElsewhere = 4, Unknown = -1.
* @var int
*/
public $ShowAs;
/**
* The start time of the event.
* @var DateTimeTimeZone
*/
public $Start;
/**
* The event type: SingleInstance = 0, Occurrence = 1, Exception = 2, SeriesMaster = 3.
* @var int
*/
public $Type;
/**
* The URL to open the event in Outlook Web App.
* @var string
*/
public $WebLink;
}

Просмотреть файл

@ -1,23 +0,0 @@
<?php
namespace Office365\PHP\Client\OutlookServices;
use Office365\PHP\Client\Runtime\ClientActionCreateEntity;
use Office365\PHP\Client\Runtime\ClientObjectCollection;
class EventCollection extends ClientObjectCollection
{
/**
* Create an event in the user's primary calendar or a specific calendar by posting to the calendar's events endpoint.
* @return Event
*/
public function createEvent() {
$event = new Event($this->getContext());
$qry = new ClientActionCreateEntity($this, $event);
$this->getContext()->addQuery($qry, $event);
$this->addChild($event);
return $event;
}
}

Просмотреть файл

@ -1,14 +0,0 @@
<?php
namespace Office365\PHP\Client\OutlookServices;
use Office365\PHP\Client\Runtime\Utilities\EnumType;
class EventType extends EnumType
{
}

Просмотреть файл

@ -1,32 +0,0 @@
<?php
namespace Office365\PHP\Client\OutlookServices;
/**
* A file (such as a text file or Word document) attached to a message or event.
*/
class FileAttachment extends Attachment
{
/**
* The binary contents of the file.
* @var string
*/
public $ContentBytes;
/**
* The ID of the attachment in the Exchange store.
* @var string
*/
public $ContentId;
/**
* The Uniform Resource Identifier (URI) that corresponds to the location of the content of the attachment.
* @var string
*/
public $ContentLocation;
}

Просмотреть файл

@ -1,10 +0,0 @@
<?php
namespace Office365\PHP\Client\OutlookServices;
class FileAttachmentCollection extends AttachmentCollection
{
}

Просмотреть файл

@ -1,26 +0,0 @@
<?php
namespace Office365\PHP\Client\OutlookServices;
use Office365\PHP\Client\Runtime\ClientActionCreateEntity;
use Office365\PHP\Client\Runtime\ClientObjectCollection;
class FolderCollection extends ClientObjectCollection
{
/**
* Creates a folder
* @param string $displayName name of new folder
* @return MailFolder
*/
public function createFolder($displayName) {
$folder = new MailFolder($this->getContext(), $this->getResourcePath());
$folder->setProperty('DisplayName', $displayName);
$qry = new ClientActionCreateEntity($this, $folder);
$this->getContext()->addQuery($qry, $folder);
$this->addChild($folder);
return $folder;
}
}

Просмотреть файл

@ -1,17 +0,0 @@
<?php
namespace Office365\PHP\Client\OutlookServices;
/**
* Specifies the availability status of an attendee for a meeting.
*/
class FreeBusyStatus
{
const Unknown = -1;
const Free = 0;
const Tentative = 1;
const Busy = 2;
const Oof = 3;
const WorkingElsewhere = 4;
}

Просмотреть файл

@ -1,46 +0,0 @@
<?php
namespace Office365\PHP\Client\OutlookServices;
use Office365\PHP\Client\Runtime\ClientValueObject;
/**
* The geographic coordinates and elevation of the location.
*/
class GeoCoordinates extends ClientValueObject
{
/**
* The altitude of the location.
* @var double
*/
public $Altitude;
/**
* The latitude of the location.
* @var double
*/
public $Latitude;
/**
* The longitude of the location.
* @var double
*/
public $Longitude;
/**
* The accuracy of the sensor providing the latitude and longitude.
* @var double
*/
public $Accuracy;
/**
* The accuracy of the sensor providing the altitude.
* @var double
*/
public $AltitudeAccuracy;
}

Просмотреть файл

@ -1,10 +0,0 @@
<?php
namespace Office365\PHP\Client\OutlookServices;
class Group
{
}

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше