WsdlToPhp /
PackageEws365
| 1 | <?php |
||
| 2 | /** |
||
| 3 | * Composer autoload |
||
| 4 | */ |
||
| 5 | require_once __DIR__ . '/../vendor/autoload.php'; |
||
| 6 | |||
| 7 | /** |
||
| 8 | * Used classes |
||
| 9 | */ |
||
| 10 | use WsdlToPhp\PackageBase\AbstractSoapClientBase; |
||
| 11 | use Ews\EnumType\EwsExchangeVersionType; |
||
|
0 ignored issues
–
show
|
|||
| 12 | use Ews\EwsClassMap; |
||
|
0 ignored issues
–
show
This use statement conflicts with another class in this namespace,
EwsClassMap. Consider defining an alias.
Let?s assume that you have a directory layout like this: .
|-- OtherDir
| |-- Bar.php
| `-- Foo.php
`-- SomeDir
`-- Foo.php
and let?s assume the following content of // Bar.php
namespace OtherDir;
use SomeDir\Foo; // This now conflicts the class OtherDir\Foo
If both files PHP Fatal error: Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.php
However, as // Bar.php
namespace OtherDir;
use SomeDir\Foo as SomeDirFoo; // There is no conflict anymore.
Loading history...
The type
Ews\EwsClassMap was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 13 | use Ews\StructType\EwsRequestServerVersion; |
||
|
0 ignored issues
–
show
The type
Ews\StructType\EwsRequestServerVersion was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 14 | use Ews\StructType\EwsGetServerTimeZonesType; |
||
|
0 ignored issues
–
show
The type
Ews\StructType\EwsGetServerTimeZonesType was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 15 | |||
| 16 | /** |
||
| 17 | * Your Office 365 login |
||
| 18 | */ |
||
| 19 | define('EWS_WS_LOGIN', ''); |
||
| 20 | /** |
||
| 21 | * Your Office 365 passowrd |
||
| 22 | */ |
||
| 23 | define('EWS_WS_PASSWORD', ''); |
||
| 24 | |||
| 25 | /** |
||
| 26 | * Minimal options in order to instanciate the ServiceType named Get |
||
| 27 | */ |
||
| 28 | $options = array( |
||
| 29 | AbstractSoapClientBase::WSDL_URL => __DIR__ . '/../wsdl/services.wsdl', |
||
| 30 | AbstractSoapClientBase::WSDL_CLASSMAP => EwsClassMap::get(), |
||
| 31 | AbstractSoapClientBase::WSDL_LOGIN => EWS_WS_LOGIN, |
||
| 32 | AbstractSoapClientBase::WSDL_PASSWORD => EWS_WS_PASSWORD, |
||
| 33 | ); |
||
| 34 | |||
| 35 | /** |
||
| 36 | * Instanciation of the ServiceType get that gather all the operations beginnig with "get". |
||
| 37 | */ |
||
| 38 | $get = new \Ews\ServiceType\EwsGet($options); |
||
|
0 ignored issues
–
show
The type
Ews\ServiceType\EwsGet was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 39 | /** |
||
| 40 | * Configure the SoapHeader, each header's method begins with "setSoapHeader". |
||
| 41 | */ |
||
| 42 | $get->setSoapHeaderRequestServerVersion(new EwsRequestServerVersion(EwsExchangeVersionType::VALUE_EXCHANGE_2013_SP_1)); |
||
| 43 | /** |
||
| 44 | * Send the request, you can customize the request by modifiying the new EwsGetServerTimeZonesType() instance |
||
| 45 | */ |
||
| 46 | $result = $get->GetServerTimeZones(new EwsGetServerTimeZonesType()); |
||
| 47 | |||
| 48 | /** |
||
| 49 | * Debug informations provided by the utility methods |
||
| 50 | */ |
||
| 51 | if (false) { |
||
| 52 | echo 'XML Request: ' . $get->getLastRequest() . "\r\n"; |
||
| 53 | echo 'Headers Request: ' . $get->getLastRequestHeaders() . "\r\n"; |
||
| 54 | echo 'XML Response: ' . $get->getLastResponse() . "\r\n"; |
||
| 55 | echo 'Headers Response: ' . $get->getLastResponseHeaders() . "\r\n"; |
||
| 56 | } |
||
| 57 | |||
| 58 | /** |
||
| 59 | * Sample call for GetServerTimeZones operation/method |
||
| 60 | */ |
||
| 61 | if ($result !== false) { |
||
| 62 | /** |
||
| 63 | * @var Ews\StructType\EwsArrayOfResponseMessagesType |
||
| 64 | */ |
||
| 65 | $responseMessages = $result->getResponseMessages(); |
||
| 66 | /** |
||
| 67 | * @var Ews\StructType\EwsGetServerTimeZonesResponseMessageType |
||
| 68 | */ |
||
| 69 | $response = $responseMessages->getGetServerTimeZonesResponseMessage(); |
||
| 70 | $response = $response[0]; |
||
| 71 | /** |
||
| 72 | * @var Ews\ArrayType\EwsArrayOfTimeZoneDefinitionType |
||
| 73 | */ |
||
| 74 | $timeZoneDefinitions = $response->getTimeZoneDefinitions(); |
||
| 75 | $timeZoneDefinitions->initInternArray(); |
||
| 76 | /** |
||
| 77 | * Display the TimeZones if there is at least one: |
||
| 78 | * |
||
| 79 | * 108 timezones found! |
||
| 80 | * Id: Dateline Standard Time, Name: (UTC-12:00) International Date Line West |
||
| 81 | * Id: Samoa Standard Time, Name: (UTC+13:00) Samoa |
||
| 82 | * Id: UTC-11, Name: (UTC-11:00) Coordinated Universal Time-11 |
||
| 83 | * Id: Hawaiian Standard Time, Name: (UTC-10:00) Hawaii |
||
| 84 | * Id: Alaskan Standard Time, Name: (UTC-09:00) Alaska |
||
| 85 | * Id: Pacific Standard Time (Mexico), Name: (UTC-08:00) Baja California |
||
| 86 | * Id: Pacific Standard Time, Name: (UTC-08:00) Pacific Time (US & Canada) |
||
| 87 | * Id: US Mountain Standard Time, Name: (UTC-07:00) Arizona |
||
| 88 | * Id: Mountain Standard Time (Mexico), Name: (UTC-07:00) Chihuahua, La Paz, Mazatlan |
||
| 89 | * Id: Mountain Standard Time, Name: (UTC-07:00) Mountain Time (US & Canada) |
||
| 90 | * Id: Central America Standard Time, Name: (UTC-06:00) Central America |
||
| 91 | * ... etc |
||
| 92 | * |
||
| 93 | * Otherwise it displays: |
||
| 94 | * No timezone found! |
||
| 95 | */ |
||
| 96 | if ($timeZoneDefinitions->count() > 0) { |
||
| 97 | echo PHP_EOL . sprintf('%d timezones found!', $timeZoneDefinitions->count()) . PHP_EOL; |
||
| 98 | foreach ($timeZoneDefinitions as $timeZoneDefinition) { |
||
| 99 | echo sprintf('Id: %s, Name: %s', $timeZoneDefinition->getId(), $timeZoneDefinition->getName()) . PHP_EOL; |
||
| 100 | } |
||
| 101 | } else { |
||
| 102 | echo PHP_EOL . 'No timezone found!'; |
||
| 103 | } |
||
| 104 | } else { |
||
| 105 | /** |
||
| 106 | * In this case, we get the \SoapFault object |
||
| 107 | */ |
||
| 108 | print_r($get->getLastErrorForMethod('\Ews\ServiceType\EwsGet::GetServerTimeZones')); |
||
| 109 | } |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths