From ec4701c1c203b8fa2b7f02c3150422e9a46138d7 Mon Sep 17 00:00:00 2001 From: Andrei Shapiro Date: Thu, 11 May 2023 11:33:15 +0000 Subject: [PATCH 1/5] chore: apply PSR-12 --- common/cache/class.Exception.php | 1 + common/cache/class.KeyValueCache.php | 8 +- common/cache/class.NoCache.php | 3 +- common/cache/class.NotFoundException.php | 1 + common/cache/class.PartitionedCachable.php | 27 +-- common/cache/class.PsrWrapperCache.php | 3 +- common/cache/class.SingletonCache.php | 1 + common/cache/interface.Cache.php | 3 +- common/class.AjaxResponse.php | 15 +- common/class.Collection.php | 59 +++---- common/class.Config.php | 1 + common/class.Exception.php | 1 + common/class.Logger.php | 35 ++-- common/class.Object.php | 2 +- common/class.Utils.php | 6 +- .../class.BoundableComponent.php | 15 +- common/configuration/class.Component.php | 15 +- .../class.ComponentCollection.php | 163 +++++++++--------- .../configuration/class.ComponentFactory.php | 79 ++++----- .../class.ComponentFactoryException.php | 1 + .../class.CyclicDependencyException.php | 1 + .../class.FileSystemComponent.php | 15 +- .../class.MalformedRightsException.php | 1 + common/configuration/class.Mock.php | 11 +- .../configuration/class.PHPDatabaseDriver.php | 7 +- common/configuration/class.PHPExtension.php | 13 +- common/configuration/class.PHPINIValue.php | 17 +- common/configuration/class.PHPRuntime.php | 15 +- common/configuration/class.Report.php | 21 +-- common/exception/class.BadRequest.php | 1 + common/exception/class.ClassAlreadyExists.php | 2 +- common/exception/class.ClientException.php | 1 - .../exception/class.DeprecatedApiMethod.php | 1 + common/exception/class.EmptyProperty.php | 2 +- common/exception/class.Error.php | 2 +- .../exception/class.FileAlreadyExists.php.php | 5 +- .../class.FileReadFailedException.php | 2 +- common/exception/class.FileSystemError.php | 1 + common/exception/class.InconsistentData.php | 2 +- .../exception/class.InvalidArgumentType.php | 3 +- common/exception/class.IsAjaxAction.php | 3 +- common/exception/class.MethodNotAllowed.php | 1 + common/exception/class.MissingParameter.php | 1 + common/exception/class.NoContent.php | 1 + common/exception/class.NoImplementation.php | 1 + common/exception/class.NotAcceptable.php | 2 +- common/exception/class.NotFound.php | 2 +- common/exception/class.NotImplemented.php | 3 +- .../exception/class.PreConditionFailure.php | 2 +- common/exception/class.ResourceNotFound.php | 1 + common/exception/class.RestApi.php | 1 + common/exception/class.RestNotFound.php | 2 +- .../class.SystemUnderMaintenance.php | 3 +- common/exception/class.Unauthorized.php | 2 +- common/exception/class.UnknownNamespace.php | 8 +- common/exception/class.ValidationFailed.php | 1 + .../interface.UserReadableException.php | 2 +- common/ext/action/class.InstallAction.php | 1 - common/ext/class.AbstractExtension.php | 18 +- .../ext/class.AlreadyInstalledException.php | 1 + common/ext/class.ConfigDriver.php | 12 +- common/ext/class.Extension.php | 2 +- common/ext/class.ExtensionException.php | 36 ++-- common/ext/class.ExtensionHandler.php | 4 +- common/ext/class.ExtensionLoader.php | 1 + common/ext/class.ExtensionModel.php | 6 +- common/ext/class.ExtensionUninstaller.php | 18 +- common/ext/class.ExtensionUpdater.php | 14 +- common/ext/class.ExtensionsManager.php | 12 +- common/ext/class.ForbiddenActionException.php | 1 + common/ext/class.GenerisInstaller.php | 5 +- common/ext/class.InstallationException.php | 1 + common/ext/class.Manifest.php | 1 + .../ext/class.MissingExtensionException.php | 1 + common/ext/class.Namespace.php | 1 + common/ext/class.NamespaceManager.php | 1 + common/ext/class.OutdatedVersionException.php | 1 + common/ext/class.UpdateException.php | 1 + common/ext/class.UpdateExtensions.php | 4 +- common/ext/class.UpdaterNotFoundException.php | 2 +- common/ext/event/class.ExtensionInstalled.php | 10 +- .../http/class.InvalidSignatureException.php | 1 - common/http/class.Request.php | 52 +++--- common/http/class.Response.php | 1 - common/http/interface.Credentials.php | 1 + common/http/interface.SignatureService.php | 2 +- common/inc.extension.php | 1 + common/interface.Serializable.php | 3 +- common/legacy/class.LegacyAutoLoader.php | 1 + common/log/class.ArchiveFileAppender.php | 17 +- common/log/class.BaseAppender.php | 1 + common/log/class.Dispatcher.php | 17 +- common/log/class.Item.php | 10 +- common/log/class.Logger2Psr.php | 6 +- common/log/class.SingleFileAppender.php | 1 - common/log/class.UDPAppender.php | 1 + common/log/class.XMLAppender.php | 17 +- common/log/interface.Appender.php | 3 +- common/log/interface.SeverityLevel.php | 3 +- common/oatbox/AbstractRegistry.php | 6 +- common/oatbox/BasicRegistry.php | 4 +- common/oatbox/PhpSerializable.php | 4 +- common/oatbox/PhpSerializeStateless.php | 4 +- common/oatbox/action/ActionService.php | 14 +- common/oatbox/action/Help.php | 2 +- common/oatbox/cache/KeyValueCache.php | 4 +- common/oatbox/cache/MultipleCacheTrait.php | 2 - common/oatbox/cache/SetupFileCache.php | 11 +- common/oatbox/cache/SimpleCache.php | 2 +- common/oatbox/config/ConfigSets.php | 4 +- common/oatbox/config/ConfigurationDriver.php | 1 - common/oatbox/config/ConfigurationService.php | 2 +- common/oatbox/event/Event.php | 2 +- common/oatbox/event/EventManager.php | 16 +- common/oatbox/event/GenericEvent.php | 6 +- common/oatbox/extension/ComposerInfo.php | 10 +- common/oatbox/extension/InstallAction.php | 1 - common/oatbox/extension/Manifest.php | 3 +- common/oatbox/extension/UninstallAction.php | 1 - .../exception/MalformedManifestException.php | 1 + .../extension/exception/ManifestException.php | 2 + .../exception/ManifestNotFoundException.php | 2 +- .../script/MissingOptionException.php | 4 +- .../extension/script/OptionContainer.php | 44 ++--- .../oatbox/extension/script/ScriptAction.php | 52 +++--- common/oatbox/filesystem/Directory.php | 14 +- .../oatbox/filesystem/FileSystemService.php | 26 +-- .../filesystem/utils/FlyWrapperTrait.php | 39 ++--- .../wrapper/GoogleStorageWrapper.php | 10 +- common/oatbox/install/Installer.php | 1 - common/oatbox/log/LoggerAggregator.php | 2 +- common/oatbox/log/LoggerAwareTrait.php | 16 +- common/oatbox/log/LoggerService.php | 4 +- common/oatbox/log/logger/TaoLog.php | 8 +- common/oatbox/log/logger/TaoMonolog.php | 2 +- .../formatter/CloudWatchJsonFormatter.php | 5 +- .../logger/formatter/TaoJsonLogFormatter.php | 16 +- .../logger/processor/BacktraceProcessor.php | 2 +- .../logger/processor/EnvironmentProcessor.php | 8 +- .../EnvironmentProcessorAbstract.php | 10 +- common/oatbox/mutex/LockService.php | 6 +- .../reporting/RecursiveReportIterator.php | 3 +- common/oatbox/reporting/Report.php | 1 + common/oatbox/reporting/ReportInterface.php | 3 +- .../service/ServiceNotFoundException.php | 4 +- common/oatbox/service/SimpleConfigDriver.php | 4 +- .../service/exception/InvalidService.php | 1 - .../InvalidServiceManagerException.php | 1 - common/oatbox/session/SessionService.php | 2 +- common/oatbox/task/AbstractTask.php | 1 - common/oatbox/task/AbstractTaskAction.php | 3 +- .../task/Exception/BadTaskQueueOption.php | 1 - common/oatbox/task/Queue.php | 6 +- common/oatbox/task/Task.php | 18 +- .../task/TaskInterface/TaskListIterator.php | 3 - .../oatbox/task/TaskInterface/TaskPayLoad.php | 1 - common/oatbox/task/TaskRunner.php | 4 +- common/oatbox/task/TaskService.php | 8 +- .../oatbox/task/implementation/SyncQueue.php | 3 +- .../oatbox/task/implementation/SyncTask.php | 1 - .../oatbox/task/implementation/TaskList.php | 1 - common/oatbox/user/AnonymousUser.php | 4 +- common/oatbox/user/LoginFailedException.php | 4 +- common/oatbox/user/LoginService.php | 8 +- common/oatbox/user/User.php | 4 +- .../user/UserLanguageServiceInterface.php | 3 +- common/oatbox/user/UserService.php | 2 +- common/oatbox/user/UserTimezoneService.php | 2 +- .../user/UserTimezoneServiceInterface.php | 2 +- common/oatbox/user/auth/AuthFactory.php | 4 +- common/oatbox/user/auth/LoginAdapter.php | 2 +- .../validator/AbstractFormValidator.php | 7 +- .../oatbox/validator/ValidatorInterface.php | 11 +- .../EnvironmentVariableKVDriver.php | 1 - common/persistence/KeyValue/interface.Nx.php | 1 + common/persistence/PersistenceManager.php | 1 - .../class.AdvKeyValuePersistence.php | 1 + .../persistence/class.InMemoryAdvKvDriver.php | 5 +- common/persistence/class.InMemoryKvDriver.php | 6 +- .../persistence/class.KeyValuePersistence.php | 21 +-- common/persistence/class.Manager.php | 20 +-- .../persistence/class.NoStorageKvDriver.php | 7 +- common/persistence/class.Persistence.php | 2 +- common/persistence/class.PhpFileDriver.php | 11 +- common/persistence/class.SqlKvDriver.php | 6 +- common/persistence/class.SqlPersistence.php | 6 +- common/persistence/interface.AdvKvDriver.php | 1 + common/persistence/interface.Driver.php | 4 +- .../persistence/interface.HashTableDriver.php | 9 +- common/persistence/interface.KvDriver.php | 4 +- common/persistence/interface.Purgable.php | 2 +- common/persistence/sql/SchemaCollection.php | 14 +- common/persistence/sql/class.Filter.php | 20 +-- common/persistence/sql/class.Platform.php | 39 ++--- .../persistence/sql/class.QueryIterator.php | 1 + .../persistence/sql/class.SchemaManager.php | 24 +-- .../sql/class.SerializationException.php | 4 +- .../sql/dbal/class.SchemaManager.php | 15 +- common/persistence/sql/interface.Driver.php | 10 +- .../sql/trait.MultipleOperations.php | 1 + .../report/class.RecursiveReportIterator.php | 2 +- common/report/class.Report.php | 1 + common/session/class.AnonymousSession.php | 12 +- common/session/class.BasicSession.php | 19 +- common/session/class.DefaultSession.php | 1 - common/session/class.RestSession.php | 1 - common/session/class.RestrictedSession.php | 27 +-- common/session/class.SessionManager.php | 13 +- common/session/interface.Session.php | 14 +- .../php/class.KeyValueSessionHandler.php | 2 +- .../session/php/interface.SessionHandler.php | 1 + common/test/class.TestUserSession.php | 32 ++-- common/uri/class.AbstractUriProvider.php | 9 +- common/uri/class.MicrotimeUriProvider.php | 11 +- common/uri/interface.UriProvider.php | 1 - .../user/auth/class.AuthFailedException.php | 2 +- common/user/auth/class.Service.php | 8 +- common/user/auth/interface.Adapter.php | 2 +- common/user/class.User.php | 2 +- config/default/event.conf.php | 1 + config/default/permissions.conf.php | 1 + config/default/userFactory.conf.php | 1 + .../Middleware/MiddlewareExtensionsMapper.php | 2 +- core/OntologyAwareTrait.php | 18 +- core/OntologyRdf.php | 14 +- core/OntologyRdfs.php | 22 +-- core/RulesRdf.php | 96 +++++------ core/data/Model.php | 15 +- core/data/ModelManager.php | 10 +- core/data/Ontology.php | 8 +- core/data/RdfInterface.php | 4 +- core/data/RdfsInterface.php | 7 +- core/data/event/ResourceCreated.php | 10 +- core/data/event/ResourceDeleted.php | 6 +- core/data/event/ResourceUpdated.php | 10 +- core/data/import/RdfImporter.php | 7 +- core/data/permission/PermissionHelper.php | 6 +- core/data/permission/PermissionInterface.php | 8 +- core/data/permission/PermissionManager.php | 6 +- .../ReverseRightLookupInterface.php | 1 + .../permission/implementation/FreeAccess.php | 4 +- .../implementation/Intersection.php | 22 +-- .../IntersectionUnionSupported.php | 12 +- .../permission/implementation/NoAccess.php | 6 +- .../fileReference/FileReferenceSerializer.php | 4 +- core/fileReference/ResourceFileSerializer.php | 6 +- core/kernel/api/class.ModelExporter.php | 1 - core/kernel/api/class.ModelFactory.php | 10 +- core/kernel/api/interface.Api.php | 3 +- core/kernel/api/interface.ApiModel.php | 3 +- core/kernel/classes/class.Class.php | 2 +- core/kernel/classes/class.ClassFactory.php | 14 +- core/kernel/classes/class.ClassIterator.php | 26 +-- core/kernel/classes/class.Container.php | 1 + .../classes/class.ContainerCollection.php | 23 +-- .../classes/class.ContainerComparator.php | 5 +- core/kernel/classes/class.DbWrapper.php | 23 +-- core/kernel/classes/class.EmptyProperty.php | 1 + core/kernel/classes/class.Literal.php | 7 +- .../class.MultiplePropertyValuesException.php | 4 +- core/kernel/classes/class.Resource.php | 5 +- core/kernel/classes/class.ResourceFactory.php | 8 +- .../classes/class.ResourceFormatter.php | 11 +- .../kernel/classes/class.ResourceIterator.php | 33 ++-- core/kernel/classes/class.Triple.php | 1 + core/kernel/impl/class.Api.php | 10 +- core/kernel/impl/class.ApiModelOO.php | 1 + core/kernel/persistence/class.Exception.php | 1 + .../class.ProhibitedFunctionException.php | 1 + core/kernel/persistence/file/FileIterator.php | 6 +- core/kernel/persistence/file/FileModel.php | 20 +-- core/kernel/persistence/file/FileRdf.php | 12 +- .../persistence/interface.ClassInterface.php | 34 ++-- .../interface.PropertyInterface.php | 4 +- .../interface.ResourceInterface.php | 3 +- core/kernel/persistence/newsql/NewSqlRdf.php | 4 +- .../persistence/smoothsql/class.Class.php | 82 ++++----- .../persistence/smoothsql/class.Exception.php | 1 + .../persistence/smoothsql/class.Property.php | 4 +- .../persistence/smoothsql/class.Resource.php | 1 - .../smoothsql/class.SmoothIterator.php | 7 +- .../smoothsql/class.SmoothModel.php | 21 ++- .../persistence/smoothsql/class.SmoothRdf.php | 16 +- .../smoothsql/class.SmoothRdfs.php | 8 +- .../persistence/smoothsql/class.Utils.php | 76 ++++---- .../smoothsql/install/SmoothRdsModel.php | 5 +- .../smoothsql/search/ComplexSearchService.php | 31 ++-- .../persistence/smoothsql/search/GateWay.php | 17 +- .../smoothsql/search/TaoResultSet.php | 10 +- .../search/driver/TaoSearchDriver.php | 17 +- .../exception/InvalidValueException.php | 1 - .../kernel/persistence/wrapper/RdfWrapper.php | 18 +- core/kernel/rules/class.Expression.php | 114 ++++++------ core/kernel/rules/class.ExpressionFactory.php | 4 +- core/kernel/rules/class.Operation.php | 50 +++--- core/kernel/rules/class.OperationFactory.php | 2 +- core/kernel/rules/class.Rule.php | 4 +- core/kernel/rules/class.Term.php | 76 ++++---- core/kernel/rules/class.TermFactory.php | 6 +- core/kernel/uri/Bin2HexUriProvider.php | 2 +- core/kernel/uri/MicrotimeRandUriProvider.php | 18 +- core/kernel/uri/UriProvider.php | 2 +- .../uri/class.AdvKeyValueUriProvider.php | 12 +- .../uri/class.DatabaseSerialUriProvider.php | 18 +- core/kernel/uri/class.UriService.php | 14 +- core/kernel/users/class.AuthAdapter.php | 18 +- core/kernel/users/class.Cache.php | 6 +- core/kernel/users/class.CacheException.php | 1 + core/kernel/users/class.Exception.php | 9 +- .../users/class.InvalidLoginException.php | 1 + core/kernel/users/class.Service.php | 69 ++++---- .../users/interface.RolesManagement.php | 6 +- .../users/interface.UsersManagement.php | 5 +- core/resource/AbstractCreateOrReuse.php | 28 +-- core/resource/CreateOrReuseInterface.php | 2 +- core/resource/ResourceCollection.php | 2 +- .../exception/DuplicateResourceException.php | 5 +- core/user/AuthAdapter.php | 16 +- core/user/PasswordConstraintsException.php | 1 - core/user/PasswordConstraintsService.php | 2 +- core/user/UserFactoryServiceInterface.php | 2 +- helpers/SystemHelper.php | 2 + helpers/UuidPrimaryKeyTrait.php | 3 +- helpers/class.ExtensionHelper.php | 12 +- helpers/class.File.php | 4 +- helpers/class.InstallHelper.php | 6 +- helpers/class.PasswordHash.php | 2 +- helpers/class.PhpTools.php | 10 +- helpers/class.Random.php | 5 +- helpers/class.RdfDiff.php | 20 +-- helpers/class.Report.php | 14 +- helpers/class.TimeOutHelper.php | 18 +- helpers/class.VersionedFile.php | 21 +-- .../Version202008201138552348_generis.php | 1 + .../Version202009081435472348_generis.php | 3 +- .../Version202009301828472348_generis.php | 1 + scripts/install/TaskQueue.php | 1 - scripts/tools/CleanUpOrphanFiles.php | 2 +- .../tools/FileSerializerMigration/Migrate.php | 2 +- .../MigrationHelper.php | 2 +- test/GenerisPhpUnitTestRunner.php | 13 +- test/KeyValueMockTrait.php | 2 +- test/bootstrap.php | 7 +- test/integration/ApiModelTest.php | 2 +- test/integration/ComplexSearchTest.php | 1 - test/integration/ConfigurationTest.php | 5 +- test/integration/DbWrapperTest.php | 1 - test/integration/ExceptionTest.php | 3 +- test/integration/GenerisIteratorTest.php | 1 - test/integration/ModelsRightTest.php | 5 +- test/integration/NamespaceTest.php | 1 - test/integration/PropertyTest.php | 9 +- test/integration/ResourceTest.php | 29 ++-- test/integration/SqlInjectionTest.php | 1 - test/integration/UserServiceTest.php | 3 +- test/integration/common/cache/CacheTest.php | 3 +- .../filesystem/DirectoryFilesystemTest.php | 1 - .../persistence/PhpFilePersistenceTest.php | 4 +- .../kernel/classes/ResourceIteratorTest.php | 1 - .../FileSerializerMigrationHelperTest.php | 6 +- .../model/persistence/file/FileModelTest.php | 3 +- .../persistence/smoothsql/SmoothModelTest.php | 3 +- .../smoothsql/SmoothsqlUtilsTest.php | 23 ++- test/integration/mutex/LockServiceTest.php | 1 - .../rules/ExpressionFactoryTest.php | 2 +- test/integration/rules/ExpressionTest.php | 1 - .../rules/OperationFactoryTest.php | 3 +- test/integration/rules/OperationTest.php | 3 +- test/integration/rules/TermFactoryTest.php | 3 +- test/integration/rules/TermTest.php | 3 +- test/unit/CollectionTest.php | 2 +- test/unit/ConfigurationTest.php | 8 +- test/unit/FileHelperTest.php | 1 - test/unit/ManifestTest.php | 11 +- test/unit/ReportTest.php | 6 +- test/unit/UtilsTest.php | 2 +- test/unit/common/ext/ExtensionTest.php | 9 +- test/unit/common/ext/samples/UpdaterMock.php | 1 + test/unit/common/http/RequestTest.php | 3 +- .../common/oatbox/cache/CacheItemTest.php | 2 +- .../log/logger/handler/FluentdHandlerTest.php | 3 +- .../persistence/KeyValuePersistenceTest.php | 12 +- .../persistence/NoStoragePersistenceTest.php | 17 +- .../persistence/PersistenceManagerTest.php | 4 +- .../PhpFilePersistenceTtlModeTest.php | 4 +- .../common/persistence/sql/PlatformTest.php | 1 - .../persistence/sql/dbal/DriverTest.php | 1 - test/unit/common/session/BasicSessionTest.php | 3 +- test/unit/core/UrlFileSerializerTest.php | 18 +- test/unit/core/data/import/RdfImportTest.php | 2 +- .../core/data/permission/PermissionTest.php | 6 +- test/unit/core/kernel/classes/ClassTest.php | 2 +- test/unit/extension/ComposerInfoTest.php | 16 +- test/unit/helpers/FileTest.php | 20 +-- test/unit/helpers/SystemHelperTest.php | 1 - .../unit/helpers/UuidPrimaryKeyHelperTest.php | 2 +- test/unit/model/ResourceFormatterTest.php | 6 +- .../persistence/newsql/NewSqlRdfTest.php | 10 +- .../smoothsql/SmoothModelIteratorTest.php | 1 - .../persistence/smoothsql/SmoothRdfTest.php | 2 +- test/unit/oatbox/ConfigurableTest.php | 6 +- test/unit/oatbox/EventManagerTest.php | 4 +- test/unit/oatbox/cache/KeyValueCacheTest.php | 1 + test/unit/oatbox/config/ConfigSetsTest.php | 1 - .../unit/oatbox/event/EventAggregatorTest.php | 10 +- .../oatbox/extension/InstallActionTest.php | 39 ++--- .../oatbox/extension/UninstallActionTest.php | 33 ++-- .../extension/script/OptionContainerTest.php | 1 - test/unit/oatbox/log/LoggerServiceTest.php | 4 +- test/unit/oatbox/mutex/LockServiceTest.php | 2 - .../service/EnvironmentVariableTest.php | 2 +- .../oatbox/service/ServiceManagerTest.php | 5 +- 412 files changed, 1865 insertions(+), 1866 deletions(-) diff --git a/common/cache/class.Exception.php b/common/cache/class.Exception.php index dbd4039ee..ee72ac0b4 100644 --- a/common/cache/class.Exception.php +++ b/common/cache/class.Exception.php @@ -1,4 +1,5 @@ persistence)) { diff --git a/common/cache/class.NoCache.php b/common/cache/class.NoCache.php index a1c5c917d..94fa481b5 100644 --- a/common/cache/class.NoCache.php +++ b/common/cache/class.NoCache.php @@ -27,7 +27,6 @@ */ class common_cache_NoCache extends ConfigurableService implements common_cache_Cache { - public function has($key) { return false; @@ -47,7 +46,7 @@ public function remove($serial) { return true; } - + public function get($serial) { throw new common_cache_NotFoundException(); diff --git a/common/cache/class.NotFoundException.php b/common/cache/class.NotFoundException.php index 672a25b88..de9e3142e 100644 --- a/common/cache/class.NotFoundException.php +++ b/common/cache/class.NotFoundException.php @@ -1,4 +1,5 @@ serial)) { $this->serial = $this->buildSerial(); } $returnValue = $this->serial; - + return (string) $returnValue; } @@ -84,7 +85,7 @@ public function getSerial() */ public function __construct() { - + if (!is_null($this->getCache())) { $this->getCache()->put($this); } @@ -101,7 +102,7 @@ public function __sleep() { $returnValue = []; - + $this->serializedProperties = []; $reflection = new ReflectionClass($this); foreach ($reflection->getProperties() as $property) { @@ -137,7 +138,7 @@ public function __sleep() } } } - + return (array) $returnValue; } @@ -151,7 +152,7 @@ public function __sleep() */ public function __wakeup() { - + foreach ($this->serializedProperties as $key => $value) { if (is_array($value)) { $restored = []; @@ -175,7 +176,7 @@ public function __wakeup() */ public function _remove() { - + //usefull only when persistance is enabled if (!is_null($this->getCache())) { //clean session @@ -194,7 +195,7 @@ public function getSuccessors() { $returnValue = []; - + $reflection = new ReflectionClass($this); foreach ($reflection->getProperties() as $property) { if (!$property->isStatic() && !$property->isPrivate()) { @@ -203,15 +204,15 @@ public function getSuccessors() if (is_array($value)) { foreach ($value as $key => $subvalue) { if (is_object($subvalue) && $subvalue instanceof self) { - $returnValue[] = $subvalue; + $returnValue[] = $subvalue; } } } elseif (is_object($value) && $value instanceof self) { - $returnValue[] = $value; + $returnValue[] = $value; } } } - + return (array) $returnValue; } @@ -228,7 +229,7 @@ public function getPredecessors($classFilter = null) { $returnValue = []; - + foreach ($this->getCache()->getAll() as $serial => $instance) { if ( ($classFilter == null || $instance instanceof $classFilter) @@ -238,7 +239,7 @@ public function getPredecessors($classFilter = null) break; } } - + return (array) $returnValue; } diff --git a/common/cache/class.PsrWrapperCache.php b/common/cache/class.PsrWrapperCache.php index 3c2f212f9..b560a90a4 100644 --- a/common/cache/class.PsrWrapperCache.php +++ b/common/cache/class.PsrWrapperCache.php @@ -29,7 +29,6 @@ */ class common_cache_PsrWrapperCache extends ConfigurableService implements common_cache_Cache { - /** * puts "something" into the cache, * * If this is an object and implements Serializable, @@ -112,7 +111,7 @@ public function purge() return $this->getPsrSimpleCache()->clear(); } - protected function getPsrSimpleCache() : CacheInterface + protected function getPsrSimpleCache(): CacheInterface { return $this->getServiceLocator()->get(SimpleCache::SERVICE_ID); } diff --git a/common/cache/class.SingletonCache.php b/common/cache/class.SingletonCache.php index ce33c2ad5..6faf23780 100755 --- a/common/cache/class.SingletonCache.php +++ b/common/cache/class.SingletonCache.php @@ -1,4 +1,5 @@ getResponse()->setContentHeader('application/json'); @@ -67,7 +68,7 @@ public function __construct(array $options = []) , 'message' => $message , 'data' => $data ]; - + //write the response echo json_encode($response); } diff --git a/common/class.Collection.php b/common/class.Collection.php index 9ef28a4af..f463f4947 100644 --- a/common/class.Collection.php +++ b/common/class.Collection.php @@ -1,4 +1,5 @@ sequence = []; $this->container = $container; } @@ -88,9 +89,9 @@ public function count() { $returnValue = (int) 0; - + $returnValue = count($this->sequence); - + return (int) $returnValue; } @@ -107,14 +108,14 @@ public function indexOf(common_Object $object) { $returnValue = (int) 0; - + $returnValue = -1; foreach ($this->sequence as $index => $_object) { if ($object === $_object) { return $index; } } - + return (int) $returnValue; } @@ -131,13 +132,13 @@ public function get($index) { $returnValue = null; - - + + $returnValue = isset($this->sequence[$index]) ? $this->sequence[$index] : null; if ($returnValue == null) { throw new common_Exception('index is out of range'); } - + return $returnValue; } @@ -153,9 +154,9 @@ public function isEmpty() { $returnValue = (bool) false; - + $returnValue = (count($this->sequence) == 0); - + return (bool) $returnValue; } @@ -171,7 +172,7 @@ public function isEmpty() */ public function offsetSet(common_Object $key, common_Object $value) { - + $this->sequence[$key] = $value; } @@ -187,9 +188,9 @@ public function offsetGet(common_Object $key) { $returnValue = null; - + $returnValue = $this->sequence[$key]; - + return $returnValue; } @@ -204,7 +205,7 @@ public function offsetGet(common_Object $key) */ public function offsetUnset(common_Object $key) { - + unset($this->sequence[$key]); } @@ -220,9 +221,9 @@ public function offsetExists(common_Object $key) { $returnValue = (bool) false; - + $returnValue = isset($this->sequence[$key]); - + return (bool) $returnValue; } @@ -236,8 +237,8 @@ public function offsetExists(common_Object $key) */ public function getIterator() { - - return new ArrayIterator($this->sequence); + + return new ArrayIterator($this->sequence); } /** @@ -250,7 +251,7 @@ public function getIterator() */ public function add(common_Object $node) { - + $this->sequence[] = $node; $returnValue = $node; } @@ -267,7 +268,7 @@ public function remove(common_Object $object) { $returnValue = (bool) false; - + foreach ($this->sequence as $index => $_node) { if ($_node === $object) { unset($this->sequence[$index]); @@ -276,7 +277,7 @@ public function remove(common_Object $object) } } return false; - + return (bool) $returnValue; } @@ -293,10 +294,10 @@ public function union(common_Collection $collection) { $returnValue = null; - + $returnValue = new common_Collection($this); $returnValue->sequence = array_merge($this->sequence, $collection->sequence); - + return $returnValue; } @@ -313,10 +314,10 @@ public function intersect(common_Collection $collection) { $returnValue = null; - - $returnValue = new common_Collection(new common_Object(__METHOD__)); - $returnValue->sequence = array_uintersect($this->sequence, $collection->sequence, 'core_kernel_classes_ContainerComparator::compare'); - + + $returnValue = new common_Collection(new common_Object(__METHOD__)); + $returnValue->sequence = array_uintersect($this->sequence, $collection->sequence, 'core_kernel_classes_ContainerComparator::compare'); + return $returnValue; } @@ -332,11 +333,11 @@ public function toArray() { $returnValue = []; - + foreach ($this->getIterator() as $it) { $returnValue[] = $it; } - + return (array) $returnValue; } diff --git a/common/class.Config.php b/common/class.Config.php index 6d7a15012..dc0c1c171 100755 --- a/common/class.Config.php +++ b/common/class.Config.php @@ -1,4 +1,5 @@ stateStack[] = self::singleton()->enabled; $this->enabled = true; } @@ -230,7 +231,7 @@ public function enable() */ public function disable() { - + $this->stateStack[] = self::singleton()->enabled; $this->enabled = false; } @@ -244,7 +245,7 @@ public function disable() */ public function restore() { - + if (count($this->stateStack) > 0) { $this->enabled = array_pop($this->stateStack); } else { @@ -263,7 +264,7 @@ public function restore() */ public static function t($message, $tags = []) { - + self::singleton()->log(self::TRACE_LEVEL, $message, $tags); } @@ -278,7 +279,7 @@ public static function t($message, $tags = []) */ public static function d($message, $tags = []) { - + self::singleton()->log(self::DEBUG_LEVEL, $message, $tags); } @@ -295,7 +296,7 @@ public static function d($message, $tags = []) */ public static function i($message, $tags = []) { - + self::singleton()->log(self::INFO_LEVEL, $message, $tags); } @@ -310,7 +311,7 @@ public static function i($message, $tags = []) */ public static function w($message, $tags = []) { - + self::singleton()->log(self::WARNING_LEVEL, $message, $tags); } diff --git a/common/class.Object.php b/common/class.Object.php index 2fb64bbf8..14f0422fa 100644 --- a/common/class.Object.php +++ b/common/class.Object.php @@ -1,4 +1,5 @@ setMin($min); $this->setMax($max); @@ -83,7 +84,7 @@ public function __construct($min, $max, $name = 'unknown', $optional = false) */ public function setMin($min) { - + $this->min = $min; } @@ -98,9 +99,9 @@ public function getMin() { $returnValue = (string) ''; - + return $this->min; - + return (string) $returnValue; } @@ -115,7 +116,7 @@ public function getMin() */ public function setMax($max) { - + // Support .x notation. if (!empty($max)) { $this->max = preg_replace('/x/u', '99999', $max); @@ -135,9 +136,9 @@ public function getMax() { $returnValue = (string) ''; - + return $this->max; - + return (string) $returnValue; } diff --git a/common/configuration/class.Component.php b/common/configuration/class.Component.php index 72201ac66..c72f65925 100644 --- a/common/configuration/class.Component.php +++ b/common/configuration/class.Component.php @@ -1,4 +1,5 @@ setName($name); $this->setOptional($optional); } @@ -91,9 +92,9 @@ public function isOptional() { $returnValue = (bool) false; - + $returnValue = $this->optional; - + return (bool) $returnValue; } @@ -108,7 +109,7 @@ public function isOptional() */ public function setOptional($optional) { - + $this->optional = $optional; } @@ -123,9 +124,9 @@ public function getName() { $returnValue = (string) ''; - + $returnValue = $this->name; - + return (string) $returnValue; } @@ -140,7 +141,7 @@ public function getName() */ public function setName($name) { - + $this->name = $name; } } /* end of abstract class common_configuration_Component */ diff --git a/common/configuration/class.ComponentCollection.php b/common/configuration/class.ComponentCollection.php index a8cb40822..58bbaf373 100644 --- a/common/configuration/class.ComponentCollection.php +++ b/common/configuration/class.ComponentCollection.php @@ -1,4 +1,5 @@ getComponents(); - + // Search for a similar... foreach ($components as $c) { if ($c === $component) { @@ -108,7 +109,7 @@ public function addComponent(common_configuration_Component $component) return; } } - + // Not stored yet. $components[] = $component; $this->setComponents($components); @@ -125,9 +126,9 @@ public function addComponent(common_configuration_Component $component) */ public function addDependency(common_configuration_Component $component, common_configuration_Component $dependency) { - + $dependencies = $this->getDependencies(); - + $found = false; foreach ($dependencies as $dep) { if ($dependency === $dep['component'] && $component === $dep['isDependencyOf']) { @@ -135,7 +136,7 @@ public function addDependency(common_configuration_Component $component, common_ break; } } - + if (false == $found) { $dependencies[] = ['component' => $dependency, 'isDependencyOf' => $component]; $this->setDependencies($dependencies); @@ -151,7 +152,7 @@ public function addDependency(common_configuration_Component $component, common_ */ public function reset() { - + $this->setComponents([]); $this->setDependencies([]); $this->setCheckedComponents([]); @@ -169,15 +170,15 @@ public function check() { $returnValue = []; - + // Reset what should be reset for another check on the same instance. $this->setCheckedComponents([]); $this->setReports([]); - + $components = $this->getComponents(); $dependencies = $this->getDependencies(); $traversed = []; - + // Any node that has no incoming edge and is not // the root mock should be bound to it. foreach ($components as $c) { @@ -189,50 +190,50 @@ public function check() break; } } - + // No incoming edge. if ($found === false && $c !== $this->getRootComponent()) { $this->addDependency($c, $this->getRootComponent()); } } - + if (count($components) > 0) { if (true == $this->isAcyclic()) { // We go for a Depth First Search in the graph. $stack = []; $node = $components[0]; - + // Do something with my node. $status = $this->checkComponent($node); array_push($traversed, $node); // mark the node as 'traversed'. - + if ($status == common_configuration_Report::VALID) { $stack = self::pushTransitionsOnStack($stack, $this->getTransitions($node)); // put all transitions from the node to stack. - + while (count($stack) > 0) { $transition = array_pop($stack); $node = $transition['isDependencyOf']; - + // If not already traversed, do something with my node. if (false == in_array($node, $traversed)) { // Do something with my node. $status = $this->checkComponent($node); array_push($traversed, $node); - + if ($status == common_configuration_Report::VALID) { $stack = self::pushTransitionsOnStack($stack, $this->getTransitions($node)); } } } } - + $returnValue = $this->getReports(); } else { throw new common_configuration_CyclicDependencyException("The dependency graph is cyclic. Please review your dependencies."); } } - - + + return (array) $returnValue; } @@ -248,24 +249,24 @@ private function isAcyclic() { $returnValue = (bool) false; - - + + // To detect if the dependency graph is acyclic or not, // we first perform a usual Topological Sorting algorithm. // If at the end of the algorith, we still have edges, // the graph is cyclic ! - - + + $l = []; // Empty list where elements are sorted. $q = []; // Set of nodes with no incoming edges. - + $components = $this->getComponents(); $dependencies = $this->getDependencies(); // used as a copy ! - + // Set q with nodes with no incoming edges. foreach ($components as $c) { $incomingEdges = false; - + foreach ($dependencies as $d) { if ($c === $d['isDependencyOf']) { // $c has incoming edges thus we reject it. @@ -273,38 +274,38 @@ private function isAcyclic() break; } } - + if ($incomingEdges == false) { array_push($q, $c); } } - + while (count($q) > 0) { $n = array_pop($q); array_push($l, $n); - + foreach ($components as $m) { // edge from n to m ? foreach ($dependencies as $k => $dep) { if ($dep['component'] === $n && $dep['isDependencyOf'] === $m) { unset($dependencies[$k]); - + // other incoming edges for m ? foreach ($dependencies as $dep) { if ($dep['isDependencyOf'] === $m) { break 2; } } - + // no incoming edges from m ! array_push($q, $m); } } } } - + $returnValue = count($dependencies) == 0; - + return (bool) $returnValue; } @@ -321,14 +322,14 @@ private function getTransitions(common_configuration_Component $component) { $returnValue = []; - + $dependencies = $this->dependencies; foreach ($dependencies as $d) { if ($d['component'] === $component) { array_push($returnValue, $d); } } - + return (array) $returnValue; } @@ -344,7 +345,7 @@ public function getCheckedComponents() { $returnValue = []; - + // Sort the checked components to make them ordered in the same // way the related components where added. $components = $this->getComponents(); @@ -356,10 +357,10 @@ public function getCheckedComponents() } } } - - + + $returnValue = $checkedComponents; - + return (array) $returnValue; } @@ -375,14 +376,14 @@ public function getUncheckedComponents() { $returnValue = []; - + $rootMock = $this->getRootComponent(); foreach ($this->getComponents() as $c) { if (false === in_array($c, $this->getCheckedComponents()) && $c !== $rootMock) { array_push($returnValue, $c); } } - + // Sort the checked components to make them ordered in the same // way the related components where added. $components = $this->getComponents(); @@ -394,9 +395,9 @@ public function getUncheckedComponents() } } } - + $returnValue = $uncheckedComponents; - + return (array) $returnValue; } @@ -414,13 +415,13 @@ public static function pushTransitionsOnStack($stack, $transitions) { $returnValue = []; - + foreach ($transitions as $t) { array_push($stack, $t); } - + $returnValue = $stack; - + return (array) $returnValue; } @@ -435,7 +436,7 @@ public static function pushTransitionsOnStack($stack, $transitions) */ public function setComponents($components) { - + $this->components = $components; } @@ -450,9 +451,9 @@ public function getComponents() { $returnValue = []; - + $returnValue = $this->components; - + return (array) $returnValue; } @@ -467,7 +468,7 @@ public function getComponents() */ private function setCheckedComponents($checkedComponents) { - + $this->checkedComponents = $checkedComponents; } @@ -481,7 +482,7 @@ private function setCheckedComponents($checkedComponents) */ private function setDependencies($dependencies) { - + $this->dependencies = $dependencies; } @@ -496,9 +497,9 @@ private function getDependencies() { $returnValue = []; - + $returnValue = $this->dependencies; - + return (array) $returnValue; } @@ -513,7 +514,7 @@ private function getDependencies() */ private function setReports($reports) { - + $this->reports = $reports; } @@ -528,7 +529,7 @@ public function getReports() { $returnValue = []; - + if (count($this->reports) == 0) { return $returnValue; } else { @@ -544,9 +545,9 @@ public function getReports() } } } - + $returnValue = $reports; - + return (array) $returnValue; } @@ -561,7 +562,7 @@ public function getReports() */ private function addReport(common_configuration_Report $report) { - + array_push($this->reports, $report); } @@ -575,7 +576,7 @@ private function addReport(common_configuration_Report $report) */ private function componentChecked(common_configuration_Component $component) { - + if ($component !== $this->getRootComponent()) { array_push($this->checkedComponents, $component); } @@ -593,17 +594,17 @@ private function checkComponent(common_configuration_Component $component) { $returnValue = (int) 0; - + $report = $component->check(); // Check the node. $this->componentChecked($component); // Mark the node as 'checked'. - + // Store the report if not silenced. if (false == $this->isSilent($component)) { $this->addReport($report); // Store the report. } - + $returnValue = $report->getStatus(); - + return (int) $returnValue; } @@ -619,9 +620,9 @@ public function getSilentComponents() { $returnValue = []; - + $returnValue = $this->silentComponents; - + return (array) $returnValue; } @@ -636,7 +637,7 @@ public function getSilentComponents() */ private function setSilentComponents($silentComponents) { - + $this->silentComponents = $silentComponents; } @@ -650,14 +651,14 @@ private function setSilentComponents($silentComponents) */ public function silent(common_configuration_Component $component) { - + $silentComponents = $this->getSilentComponents(); foreach ($silentComponents as $silent) { if ($silent === $component) { return; } } - + $silentComponents[] = $component; $this->setSilentComponents($silentComponents); } @@ -672,15 +673,15 @@ public function silent(common_configuration_Component $component) */ public function noisy(common_configuration_Component $component) { - + $silentComponents = $this->getSilentComponents(); - + foreach ($silentComponents as $k => $silent) { if ($silent === $component) { unset($silentComponents[$k]); } } - + $this->setSilentComponents($silentComponents); } @@ -696,9 +697,9 @@ private function isSilent(common_configuration_Component $component) { $returnValue = (bool) false; - + $returnValue = in_array($component, $this->getSilentComponents()); - + return (bool) $returnValue; } @@ -715,9 +716,9 @@ private function isNoisy(common_configuration_Component $component) { $returnValue = (bool) false; - + $returnValue = !in_array($component, $this->getSilentComponents()); - + return (bool) $returnValue; } @@ -731,8 +732,8 @@ private function isNoisy(common_configuration_Component $component) */ public function __construct() { - - + + // A mock root check on which any added component has a dependence. The goal // of this is to make sure that components will not stay alone with no // incoming edges in the dependency graph, making them unreachable. @@ -751,7 +752,7 @@ public function __construct() */ private function setRootComponent(common_configuration_Component $component) { - + $this->rootComponent = $component; $components = $this->getComponents(); $components[] = $component; @@ -770,9 +771,9 @@ private function getRootComponent() { $returnValue = null; - + $returnValue = $this->rootComponent; - + return $returnValue; } diff --git a/common/configuration/class.ComponentFactory.php b/common/configuration/class.ComponentFactory.php index 1dd8c3851..88f61b925 100644 --- a/common/configuration/class.ComponentFactory.php +++ b/common/configuration/class.ComponentFactory.php @@ -1,4 +1,5 @@ getMessage(); throw new common_configuration_ComponentFactoryException($msg); } - + return $returnValue; } @@ -226,11 +227,11 @@ public static function buildMock($expectedStatus, $optional = false) { $returnValue = null; - + self::incrementMockCount(); $returnValue = new common_configuration_Mock($expectedStatus, 'MockComponentCheck_' . self::getMockCount()); $returnValue->setOptional($optional); - + return $returnValue; } @@ -247,7 +248,7 @@ public static function buildFromArray($array) { $returnValue = null; - + if (!empty($array)) { if (!empty($array['type'])) { $acceptedTypes = ['PHPRuntime', 'PHPINIValue', 'PHPExtension', 'PHPDatabaseDriver', 'FileSystemComponent', 'Custom', 'Mock']; @@ -255,84 +256,84 @@ public static function buildFromArray($array) if (in_array($cleanType, $acceptedTypes)) { if (!empty($array['value'])) { $values = $array['value']; - + // Optional parameter is always used. $optional = false; if (!empty($values['optional'])) { $optional = $values['optional']; } - + switch ($cleanType) { case 'PHPRuntime': $max = null; if (!empty($values['max'])) { $max = $values['max']; } - + if (empty($values['min'])) { $msg = "Mandatory attribute 'min' is missing."; throw new common_configuration_ComponentFactoryException($msg); } - + $returnValue = self::buildPHPRuntime($values['min'], $max, $optional); break; - + case 'PHPINIValue': if (empty($values['name'])) { $msg = "Mandatory attribute 'name' is missing."; throw new common_configuration_ComponentFactoryException($msg); } - + if (empty($values['value']) && $values['value'] !== '0') { $msg = "Mandatory attribute 'value' is missing."; throw new common_configuration_ComponentFactoryException($msg); } - + $returnValue = self::buildPHPINIValue($values['name'], $values['value'], $optional); break; - + case 'PHPExtension': if (empty($values['name'])) { $msg = "Mandatory attribute 'name' is missing."; throw new common_configuration_ComponentFactoryException($msg); } - + $min = null; if (!empty($values['min'])) { $min = $values['min']; } - + $max = null; if (!empty($values['max'])) { $max = $values['max']; } - + $returnValue = self::buildPHPExtension($values['name'], $min, $max, $optional); break; - + case 'PHPDatabaseDriver': if (empty($values['name'])) { $msg = "Mandatory attribute 'name' is missing."; throw new common_configuration_ComponentFactoryException($msg); } - + $returnValue = self::buildPHPDatabaseDriver($values['name'], $optional); break; - + case 'FileSystemComponent': if (empty($values['location'])) { $msg = "Mandatory attribute 'location' is missing."; throw new common_configuration_ComponentFactoryException($msg); } - + if (empty($values['rights'])) { $msg = "Mandatory attribute 'rights' is missing."; throw new common_configuration_ComponentFactoryException($msg); } - + $returnValue = self::buildFileSystemComponent($values['location'], $values['rights'], $optional); break; - + case 'Custom': if (empty($values['name'])) { $msg = "Mandatory attribute 'name' is missing."; @@ -343,16 +344,16 @@ public static function buildFromArray($array) if (!empty($values['extension'])) { $extension = $values['extension']; } - + $returnValue = self::buildCustom($values['name'], $extension, $optional); break; - + case 'Mock': $status = common_configuration_Report::VALID; if (!empty($values['status'])) { $status = $values['status']; } - + $returnValue = self::buildMock($status, $optional); break; } @@ -372,7 +373,7 @@ public static function buildFromArray($array) $msg = 'Cannot build a Configuration Component with an empty array.'; throw new common_configuration_ComponentFactoryException($msg); } - + return $returnValue; } @@ -401,7 +402,7 @@ private static function getFileSystemCount() */ private static function setFileSystemCount($fileSystemCount) { - + self::$fileSystemCount = $fileSystemCount; } @@ -414,7 +415,7 @@ private static function setFileSystemCount($fileSystemCount) */ private static function incrementFileSystemCount() { - + $count = self::getFileSystemCount(); $count++; self::setFileSystemCount($count); @@ -444,7 +445,7 @@ private static function getMockCount() */ private static function setMockCount($mockCount) { - + self::$mockCount = $mockCount; } @@ -457,7 +458,7 @@ private static function setMockCount($mockCount) */ private static function incrementMockCount() { - + $count = self::getMockCount(); $count++; self::setMockCount($count); diff --git a/common/configuration/class.ComponentFactoryException.php b/common/configuration/class.ComponentFactoryException.php index 2ba83f199..45c7a09c6 100644 --- a/common/configuration/class.ComponentFactoryException.php +++ b/common/configuration/class.ComponentFactoryException.php @@ -1,4 +1,5 @@ location = $location; } - + /** * Set $this->recursive value * @@ -129,7 +130,7 @@ public function setRecursive($recursive) { $this->recursive = $recursive; } - + /** * Get $this->recursive value * @@ -205,7 +206,7 @@ public function getExpectedRights() */ public function setExpectedRights($expectedRights) { - + if (!empty($expectedRights) && preg_match('/^r*w*x*$/', $expectedRights) !== 0) { $this->expectedRights = $expectedRights; } else { @@ -227,7 +228,7 @@ public function check() $expectedRights = $this->getExpectedRights(); $location = $this->getLocation(); $name = $this->getName(); - + if (!$this->exists()) { return new common_configuration_Report( common_configuration_Report::UNKNOWN, @@ -242,7 +243,7 @@ public function check() $this ); } - + if (strpos($expectedRights, 'w') !== false && !$this->isWritable($location)) { return new common_configuration_Report( common_configuration_Report::INVALID, @@ -268,7 +269,7 @@ public function check() ); } } - + return new common_configuration_Report( common_configuration_Report::VALID, "File system component '${name}' in '${location} is compliant with expected rights (${expectedRights}).'", diff --git a/common/configuration/class.MalformedRightsException.php b/common/configuration/class.MalformedRightsException.php index ac8c1a2e6..8bed9bb74 100644 --- a/common/configuration/class.MalformedRightsException.php +++ b/common/configuration/class.MalformedRightsException.php @@ -1,4 +1,5 @@ setExpectedStatus($expectedStatus); $this->setName($name); } @@ -73,7 +74,7 @@ public function __construct($expectedStatus, $name) */ public function check() { - + $message = 'Mock configuration report.'; $report = new common_configuration_Report($this->getExpectedStatus(), $message, $this); return $report; @@ -91,9 +92,9 @@ public function getExpectedStatus() { $returnValue = (int) 0; - + $returnValue = $this->expectedStatus; - + return (int) $returnValue; } @@ -108,7 +109,7 @@ public function getExpectedStatus() */ public function setExpectedStatus($expectedStatus) { - + $this->expectedStatus = $expectedStatus; } } diff --git a/common/configuration/class.PHPDatabaseDriver.php b/common/configuration/class.PHPDatabaseDriver.php index a5c26e6b9..f4b1564a1 100644 --- a/common/configuration/class.PHPDatabaseDriver.php +++ b/common/configuration/class.PHPDatabaseDriver.php @@ -1,4 +1,5 @@ getName(); - + if ($report->getStatus() == common_configuration_Report::VALID) { $report->setMessage("Database Driver '${name}' is available."); } else { @@ -59,7 +60,7 @@ public function check() } $returnValue = $report; - + return $returnValue; } diff --git a/common/configuration/class.PHPExtension.php b/common/configuration/class.PHPExtension.php index 8ec76fcfa..a7ac41700 100644 --- a/common/configuration/class.PHPExtension.php +++ b/common/configuration/class.PHPExtension.php @@ -1,4 +1,5 @@ getName(); $min = $this->getMin(); $max = $this->getMax(); $validity = null; $message = null; - + if (extension_loaded($name)) { $current = $this->getValue(); - + if (!empty($min) && !empty($max)) { // Both min and max are specified. if (version_compare($current, $min, '>=') && version_compare($current, $max, '<=')) { @@ -97,7 +98,7 @@ public function check() } $returnValue = new common_configuration_Report($validity, $message, $this); - + return $returnValue; } @@ -113,9 +114,9 @@ public function getValue() { $returnValue = (string) ''; - + $returnValue = phpversion($this->getName()); - + return (string) $returnValue; } diff --git a/common/configuration/class.PHPINIValue.php b/common/configuration/class.PHPINIValue.php index c4af012e3..8c12d728a 100644 --- a/common/configuration/class.PHPINIValue.php +++ b/common/configuration/class.PHPINIValue.php @@ -1,4 +1,5 @@ setExpectedValue($expectedValue); } @@ -73,7 +74,7 @@ public function check() { $returnValue = null; - + $validity = null; $name = $this->getName(); if (($value = ini_get($name)) !== false) { @@ -92,7 +93,7 @@ public function check() } $returnValue = new common_configuration_Report($validity, $message, $this); - + return $returnValue; } @@ -108,9 +109,9 @@ public function getExpectedValue() { $returnValue = (string) ''; - + return $this->expectedValue; - + return (string) $returnValue; } @@ -125,7 +126,7 @@ public function getExpectedValue() */ public function setExpectedValue($expectedValue) { - + $this->expectedValue = $expectedValue; } @@ -140,9 +141,9 @@ public function getValue() { $returnValue = (string) ''; - + $returnValue = ini_get($this->getName()); - + return (string) $returnValue; } diff --git a/common/configuration/class.PHPRuntime.php b/common/configuration/class.PHPRuntime.php index b5652f277..1ef97e7b6 100644 --- a/common/configuration/class.PHPRuntime.php +++ b/common/configuration/class.PHPRuntime.php @@ -1,4 +1,5 @@ getMin(); $max = $this->getMax(); $current = $this->getValue(); - + if (!empty($min) && !empty($max)) { // min & max are specifed. if (version_compare($current, $min, '>=') && version_compare($current, $max, '<=')) { @@ -81,9 +82,9 @@ public function check() $message = "PHP Version (${current}) is greater than ${max}."; } } - + $returnValue = new common_configuration_Report($validity, $message, $this); - + return $returnValue; } @@ -99,9 +100,9 @@ public function getValue() { $returnValue = (string) ''; - + $returnValue = phpversion(); - + return (string) $returnValue; } @@ -118,7 +119,7 @@ public function getValue() */ public function __construct($min, $max, $optional = false) { - + parent::__construct($min, $max, 'tao.configuration.phpruntime', $optional); } } diff --git a/common/configuration/class.Report.php b/common/configuration/class.Report.php index fd8b98ef8..2868a5fae 100644 --- a/common/configuration/class.Report.php +++ b/common/configuration/class.Report.php @@ -1,4 +1,5 @@ setStatus($status); $this->setMessage($message); - + if (!empty($component)) { $this->setComponent($component); } @@ -143,21 +144,21 @@ public function getStatusAsString() { $returnValue = (string) ''; - + switch ($this->getStatus()) { case self::INVALID: $returnValue = 'invalid'; break; - + case self::UNKNOWN: $returnValue = 'unknown'; break; - + case self::VALID: $returnValue = 'valid'; break; } - + return (string) $returnValue; } @@ -184,7 +185,7 @@ public function getMessage() */ public function setMessage($message) { - + $this->message = $message; } diff --git a/common/exception/class.BadRequest.php b/common/exception/class.BadRequest.php index de35e32af..88053338f 100644 --- a/common/exception/class.BadRequest.php +++ b/common/exception/class.BadRequest.php @@ -1,4 +1,5 @@ namespace = $namespace; - + parent::__construct('Unkown namespace "' . $namespace . '"'); } - + /** * Returns the namespace that was not found * diff --git a/common/exception/class.ValidationFailed.php b/common/exception/class.ValidationFailed.php index d81198c19..44737623f 100644 --- a/common/exception/class.ValidationFailed.php +++ b/common/exception/class.ValidationFailed.php @@ -1,4 +1,5 @@ getDefaultHeader($key); - + return $header . PHP_EOL . "return " . common_Utils::toHumanReadablePhpString($value) . ";" . PHP_EOL; } - + /** * Generates a default header * @@ -77,7 +77,7 @@ private function getDefaultHeader($key) . ' * To replace this add a file ' . $this->getHeaderPath($key) . PHP_EOL . ' */' . PHP_EOL; } - + /** * Returns the path to the expected header file * @@ -95,7 +95,7 @@ private function getHeaderPath($key) return null; } } - + /** * (non-PHPdoc) * @see common_persistence_PhpFileDriver::getPath() diff --git a/common/ext/class.Extension.php b/common/ext/class.Extension.php index 22a7e2bfd..9519dfbc5 100755 --- a/common/ext/class.Extension.php +++ b/common/ext/class.Extension.php @@ -49,7 +49,7 @@ class common_ext_Extension implements ServiceManagerAwareInterface * * @var string */ - const MANIFEST_NAME = 'manifest.php'; + public const MANIFEST_NAME = 'manifest.php'; /** * List of extension dependencies diff --git a/common/ext/class.ExtensionException.php b/common/ext/class.ExtensionException.php index ce5bd573d..bc22cd1a2 100644 --- a/common/ext/class.ExtensionException.php +++ b/common/ext/class.ExtensionException.php @@ -1,4 +1,5 @@ extensionId = $extensionId; } - + /** * Get the extension ID related to the exception * @@ -72,14 +72,14 @@ public function setExtensionId($extensionId) public function getExtensionId() { $returnValue = (string) ''; - - + + $returnValue = $this->extensionId; - - + + return (string) $returnValue; } - + /** * Creates a new instance of ExtensionException. * @@ -91,11 +91,11 @@ public function getExtensionId() */ public function __construct($message, $extensionId = 'unknown') { - + parent::__construct($message); $this->setExtensionId($extensionId); } - + /** * Get the severity of the error. * diff --git a/common/ext/class.ExtensionHandler.php b/common/ext/class.ExtensionHandler.php index c81ee9595..194fe9889 100644 --- a/common/ext/class.ExtensionHandler.php +++ b/common/ext/class.ExtensionHandler.php @@ -55,7 +55,7 @@ public function __construct(common_ext_Extension $extension) { $this->extension = $extension; } - + /** * @return common_ext_Extension */ @@ -63,7 +63,7 @@ protected function getExtension() { return $this->extension; } - + /** * Run Extension Script * diff --git a/common/ext/class.ExtensionLoader.php b/common/ext/class.ExtensionLoader.php index 8a95db661..e21a8ab57 100644 --- a/common/ext/class.ExtensionLoader.php +++ b/common/ext/class.ExtensionLoader.php @@ -1,4 +1,5 @@ addModelFiles($extension); } - + public function addModelFiles($extension) { foreach ($extension->getManifest()->getInstallModelFiles() as $rdfpath) { if (!file_exists($rdfpath)) { throw new common_ext_InstallationException("Unable to load ontology in '${rdfpath}' because the file does not exist."); } - + if (!is_readable($rdfpath)) { throw new common_ext_InstallationException("Unable to load ontology in '${rdfpath}' because the file is not readable."); } - + $iterator = new FileIterator($rdfpath); $this->append($iterator->getIterator()); } diff --git a/common/ext/class.ExtensionUninstaller.php b/common/ext/class.ExtensionUninstaller.php index ad57e80d4..c9740daf2 100755 --- a/common/ext/class.ExtensionUninstaller.php +++ b/common/ext/class.ExtensionUninstaller.php @@ -1,4 +1,5 @@ extension->getId(), ['UNINSTALL']); // uninstall possible if (is_null($this->extension->getManifest()->getUninstallData())) { throw new common_Exception('Problem uninstalling extension ' . $this->extension->getId() . ' : Uninstall not supported'); } - + // installed? if (!common_ext_ExtensionsManager::singleton()->isInstalled($this->extension->getId())) { throw new common_Exception('Problem uninstalling extension ' . $this->extension->getId() . ' : Not installed'); } - + // check dependcies if (helpers_ExtensionHelper::isRequired($this->extension)) { throw new common_Exception('Problem uninstalling extension ' . $this->extension->getId() . ' : Still required'); @@ -62,17 +62,17 @@ public function uninstall() common_Logger::d('uninstall script for ' . $this->extension->getId()); $this->uninstallScripts(); - + // hook $this->extendedUninstall(); - + common_Logger::d('unregister extension ' . $this->extension->getId()); $this->unregister(); - + // we purge the whole cache. $cache = $this->getServiceManager()->get(SimpleCache::SERVICE_ID); $cache->clear(); - + common_Logger::i('Uninstalled ' . $this->extension->getId()); return true; } @@ -106,7 +106,7 @@ protected function uninstallScripts() } } } - + /** * Hook to extend the uninstall procedure */ diff --git a/common/ext/class.ExtensionUpdater.php b/common/ext/class.ExtensionUpdater.php index 52a5d1bc6..f699ed62d 100644 --- a/common/ext/class.ExtensionUpdater.php +++ b/common/ext/class.ExtensionUpdater.php @@ -1,4 +1,5 @@ updateVersion($this->getExtension(), $version); } - + /** * Test if $version is the current version * @@ -80,7 +80,7 @@ public function isVersion($version) $extensionsManager = $this->getServiceManager()->get(common_ext_ExtensionsManager::SERVICE_ID); return $version == $extensionsManager->getInstalledVersion($this->getExtension()->getId()); } - + /** * Please use "skip" instead of inBetween. * @@ -93,7 +93,7 @@ public function isBetween($minVersion, $maxVersion) $current = common_ext_ExtensionsManager::singleton()->getInstalledVersion($this->getExtension()->getId()); return version_compare($minVersion, $current, '<=') && version_compare($current, $maxVersion, '<='); } - + /** * Skip from version FROM to version TO without additional required actions * @@ -138,7 +138,7 @@ public function safeLoadService($configId) * @param string $class_name */ $missingClasses = []; - + $fallbackAutoload = function ($class_name) use (&$missingClasses) { $missingClasses[] = $class_name; $split = strrpos($class_name, '\\'); @@ -154,7 +154,7 @@ public function safeLoadService($configId) spl_autoload_register($fallbackAutoload); $service = $serviceManager->get($configId); spl_autoload_unregister($fallbackAutoload); - + return $service; } } diff --git a/common/ext/class.ExtensionsManager.php b/common/ext/class.ExtensionsManager.php index 253db0b7d..12997f88a 100755 --- a/common/ext/class.ExtensionsManager.php +++ b/common/ext/class.ExtensionsManager.php @@ -39,9 +39,9 @@ */ class common_ext_ExtensionsManager extends ConfigurableService { - const EXTENSIONS_CONFIG_KEY = 'installation'; + public const EXTENSIONS_CONFIG_KEY = 'installation'; - const SERVICE_ID = 'generis/extensionManager'; + public const SERVICE_ID = 'generis/extensionManager'; public static $RESERVED_WORDS = [ 'config', 'data', 'vendor', 'tests' @@ -220,7 +220,7 @@ public function setEnabled($extensionId, $enabled = true) $exts[$extensionId]['enabled'] = (bool) $enabled; return $this->getExtensionById('generis')->setConfig(self::EXTENSIONS_CONFIG_KEY, $exts); } - + /** * Get the set of currently enabled extensions. This method * returns an array of common_ext_Extension. @@ -239,10 +239,10 @@ public function getEnabledExtensions() $returnValue[$ext->getId()] = $ext; } } - + return (array) $returnValue; } - + /** * Add the end of an installation register the new extension * @@ -298,7 +298,7 @@ public function getAvailablePackages() } /** @var SimpleCache $cache */ $cache = $this->getServiceManager()->get(SimpleCache::SERVICE_ID); - $key = static::class.'_'.__METHOD__; + $key = static::class . '_' . __METHOD__; if (!$cache->has($key)) { $cache->set($key, $composer->getAvailableTaoExtensions()); } diff --git a/common/ext/class.ForbiddenActionException.php b/common/ext/class.ForbiddenActionException.php index 1f541c72b..4910cdd1f 100644 --- a/common/ext/class.ForbiddenActionException.php +++ b/common/ext/class.ForbiddenActionException.php @@ -1,4 +1,5 @@ extension->getId() != 'generis') { throw new common_ext_ExtensionException('Tried to install "' . $this->extension->getId() . '" extension using the GenerisInstaller'); } - + $this->installLoadDefaultConfig(); $this->setupSchema(); $this->installOntology(); $this->installRegisterExt(); $this->getServiceManager()->get(SimpleCache::SERVICE_ID)->clear(); - + $this->log('d', 'Installing custom script for extension ' . $this->extension->getId()); $this->installCustomScript(); } diff --git a/common/ext/class.InstallationException.php b/common/ext/class.InstallationException.php index 6bd03e3ca..302b93d26 100644 --- a/common/ext/class.InstallationException.php +++ b/common/ext/class.InstallationException.php @@ -1,4 +1,5 @@ getServiceLocator()->get(common_ext_ExtensionsManager::SERVICE_ID); } - } diff --git a/common/ext/class.UpdaterNotFoundException.php b/common/ext/class.UpdaterNotFoundException.php index a5e8daa96..017890e81 100644 --- a/common/ext/class.UpdaterNotFoundException.php +++ b/common/ext/class.UpdaterNotFoundException.php @@ -19,9 +19,9 @@ */ declare(strict_types=1); + use oat\oatbox\extension\exception\ManifestException; class common_ext_UpdaterNotFoundException extends ManifestException { - } diff --git a/common/ext/event/class.ExtensionInstalled.php b/common/ext/event/class.ExtensionInstalled.php index 38064bd61..23c39eeb7 100644 --- a/common/ext/event/class.ExtensionInstalled.php +++ b/common/ext/event/class.ExtensionInstalled.php @@ -30,18 +30,18 @@ class common_ext_event_ExtensionInstalled implements Event * @var \common_ext_Extension */ private $extension; - - function __construct(\common_ext_Extension $extension) + + public function __construct(\common_ext_Extension $extension) { $this->extension = $extension; } - - function getExtension() + + public function getExtension() { return $this->extension; } - function getName() + public function getName() { return __CLASS__; } diff --git a/common/http/class.InvalidSignatureException.php b/common/http/class.InvalidSignatureException.php index 8ba219c8f..e4ede5248 100755 --- a/common/http/class.InvalidSignatureException.php +++ b/common/http/class.InvalidSignatureException.php @@ -29,5 +29,4 @@ */ class common_http_InvalidSignatureException extends common_Exception { - } diff --git a/common/http/class.Request.php b/common/http/class.Request.php index 7ae0f00e0..5ec4e0cee 100755 --- a/common/http/class.Request.php +++ b/common/http/class.Request.php @@ -1,4 +1,5 @@ headers[$key] = $value; } - + public function getHeaders() { return $this->headers; @@ -195,19 +195,19 @@ public function send() $curlHandler = curl_init($this->getUrl()); - //set the headers + //set the headers if ((is_array($this->headers)) and (count($this->headers) > 0)) { - curl_setopt($curlHandler, CURLOPT_HTTPHEADER, self::headerEncode($this->headers)); + curl_setopt($curlHandler, CURLOPT_HTTPHEADER, self::headerEncode($this->headers)); } switch ($this->getMethod()) { - case "HEAD":{ - curl_setopt($curlHandler, CURLOPT_NOBODY, true); - curl_setopt($curlHandler, CURLOPT_HEADER, true); + case "HEAD": + curl_setopt($curlHandler, CURLOPT_NOBODY, true); + curl_setopt($curlHandler, CURLOPT_HEADER, true); break; - } - case "POST":{ - curl_setopt($curlHandler, CURLOPT_POST, 1); - + + case "POST": + curl_setopt($curlHandler, CURLOPT_POST, 1); + if (is_array($this->params) and (count($this->params) > 0)) { $params = $this->postEncode($this->params); //application/x-www-form-urlencoded @@ -219,28 +219,26 @@ public function send() } } - - //analyse if there is a body or structured postfields - + + //analyse if there is a body or structured postfields + break; - } - case "PUT":{ + case "PUT": break; - } - case "GET":{ + + case "GET": //curl_setopt($curlHandler,CURLOPT_HTTPGET, true); break; - } } - + curl_setopt($curlHandler, CURLOPT_RETURNTRANSFER, 1); //curl_setopt($curlHandler, CURLINFO_HEADER_OUT, 1); //curl_setopt($curlHandler, CURLOPT_HEADER, true); - + $responseData = curl_exec($curlHandler); $httpResponse = new common_http_Response(); - + $httpResponse->httpCode = curl_getinfo($curlHandler, CURLINFO_HTTP_CODE); $httpResponse->headerOut = curl_getinfo($curlHandler, CURLINFO_HEADER_OUT); $httpResponse->effectiveUrl = curl_getinfo($curlHandler, CURLINFO_EFFECTIVE_URL); @@ -257,7 +255,7 @@ public function send() public static function postEncode($parameters) { - + //todo //$content_type = isset($this->headers['Content-Type']) ? $this->headers['Content-Type'] : 'text/plain'; //should detect suitable encoding diff --git a/common/http/class.Response.php b/common/http/class.Response.php index 4601a5f3f..fb670c8d4 100755 --- a/common/http/class.Response.php +++ b/common/http/class.Response.php @@ -29,7 +29,6 @@ */ class common_http_Response { - public $httpCode; public $headerOut; //CURLINFO_HEADER_OUT The request string sent. For this to work, add the CURLINFO_HEADER_OUT option to the handle by calling curl_setopt() public $effectiveUrl; // Last effective URL diff --git a/common/http/interface.Credentials.php b/common/http/interface.Credentials.php index 09423e02b..01185c86b 100755 --- a/common/http/interface.Credentials.php +++ b/common/http/interface.Credentials.php @@ -1,4 +1,5 @@ directory = rtrim($configuration['directory'], DIRECTORY_SEPARATOR); } elseif (isset($configuration['file'])) { @@ -103,13 +104,13 @@ public function init($configuration) } } } - + if (!empty($this->directory)) { $returnValue = parent::init($configuration); } else { $returnValue = false; } - + return (bool) $returnValue; } @@ -123,7 +124,7 @@ public function init($configuration) */ public function initFile() { - + if ($this->maxFileSize > 0 && file_exists($this->filename) && filesize($this->filename) >= $this->maxFileSize) { if ($this->compression == self::COMPRESSION_ZIP) { $zip = new ZipArchive(); @@ -161,7 +162,7 @@ private function getAvailableArchiveFileName() { $returnValue = (string) ''; - + $filebase = basename($this->filename); $dotpos = strrpos($filebase, "."); if ($dotpos === false) { @@ -175,7 +176,7 @@ private function getAvailableArchiveFileName() $count_string = "_" . ++$count; } $returnValue = $prefix . $count_string . $sufix; - + return (string) $returnValue; } diff --git a/common/log/class.BaseAppender.php b/common/log/class.BaseAppender.php index 2f3dcd26e..b6a636420 100644 --- a/common/log/class.BaseAppender.php +++ b/common/log/class.BaseAppender.php @@ -1,4 +1,5 @@ minLevel; - + return (int) $returnValue; } @@ -127,7 +128,7 @@ public function init($configuration) } } $returnValue = (count($this->appenders) > 0); - + return (bool) $returnValue; } @@ -143,12 +144,12 @@ public static function singleton() { $returnValue = null; - + if (is_null(self::$instance)) { self::$instance = new common_log_Dispatcher(); } $returnValue = self::$instance; - + return $returnValue; } @@ -178,7 +179,7 @@ public function __construct($config = null) */ public function addAppender(common_log_Appender $appender) { - + $this->appenders[] = $appender; if (is_null($this->minLevel) || $this->minLevel > $appender->getLogThreshold()) { $this->minLevel = $appender->getLogThreshold(); diff --git a/common/log/class.Item.php b/common/log/class.Item.php index a3d853dec..d389a7df5 100644 --- a/common/log/class.Item.php +++ b/common/log/class.Item.php @@ -1,4 +1,5 @@ description = $description; $this->severity = $severity; $this->datetime = $datetime; @@ -125,18 +125,18 @@ public function __construct($description, $severity, $datetime, $backtrace = [], $this->request = $request; $this->errorFile = $errorFile; $this->errorLine = $errorLine; - + // limit backtrace if (count($backtrace) > 50) { $backtrace = array_slice($backtrace, -50); } - + $cleanbacktrace = []; foreach ($backtrace as $key => $row) { if (isset($backtrace[$key]['object'])) { unset($backtrace[$key]['object']); } - + // WARNING // do NOT modify the variables in the backtrace directly or // objects passed by reference will be modified aswell diff --git a/common/log/class.Logger2Psr.php b/common/log/class.Logger2Psr.php index 4cee7eb43..4ed8a5d05 100644 --- a/common/log/class.Logger2Psr.php +++ b/common/log/class.Logger2Psr.php @@ -73,7 +73,7 @@ class common_log_Logger2Psr extends AbstractLogger * @var common_Logger */ private $logger; - + public function __construct(common_Logger $logger) { $this->logger = $logger; @@ -88,13 +88,13 @@ public function log($level, $message, array $context = []) $errorLevel = isset(self::$map[$level]) ? self::$map[$level] : common_Logger::ERROR_LEVEL; $this->logger->log($errorLevel, $message, $context); } - + public static function getCommonFromPsrLevel($level) { if (empty(self::$map[$level])) { throw new Exception('Invalid error level in Common level to PSR conversion: ' . $level); } - + return self::$map[$level]; } diff --git a/common/log/class.SingleFileAppender.php b/common/log/class.SingleFileAppender.php index 7aecd9de8..670039458 100644 --- a/common/log/class.SingleFileAppender.php +++ b/common/log/class.SingleFileAppender.php @@ -35,7 +35,6 @@ */ class common_log_SingleFileAppender extends common_log_BaseAppender { - /** * Name of file with log entries * diff --git a/common/log/class.UDPAppender.php b/common/log/class.UDPAppender.php index 9f89c37c4..09a12d48e 100644 --- a/common/log/class.UDPAppender.php +++ b/common/log/class.UDPAppender.php @@ -1,4 +1,5 @@ filename = $configuration['file']; $returnValue = parent::init($configuration); } else { $returnValue = false; } - + return (bool) $returnValue; } @@ -80,7 +81,7 @@ public function init($configuration) */ public function doLog(common_log_Item $item) { - + $doc = new DOMDocument(); $doc->preserveWhiteSpace = false; $doc->formatOutput = true; @@ -96,32 +97,32 @@ public function doLog(common_log_Item $item) $doc->createCDATASection($item->getDescription()) ); $event_element->appendChild($message); - + $file = $doc->createElement("file"); $file->appendChild( $doc->createCDATASection($item->getCallerFile()) ); $event_element->appendChild($file); - + $line = $doc->createElement("line"); $line->appendChild( $doc->createCDATASection($item->getCallerLine()) ); $event_element->appendChild($line); - + $datetime = $doc->createElement("datetime"); $datetime->appendChild( $doc->createCDATASection($item->getDateTime()) ); $event_element->appendChild($datetime); - + $severity = $doc->createElement("severity"); $severity->appendChild( $doc->createCDATASection($item->getSeverity()) ); $event_element->appendChild($severity); - + $doc->documentElement->appendChild($event_element); @$doc->save($this->filename); } diff --git a/common/log/interface.Appender.php b/common/log/interface.Appender.php index 760ba6268..bd2d0d151 100644 --- a/common/log/interface.Appender.php +++ b/common/log/interface.Appender.php @@ -1,4 +1,5 @@ getMap()); } - - + + /** * * Retrieve the given element from the array in config diff --git a/common/oatbox/BasicRegistry.php b/common/oatbox/BasicRegistry.php index 26643a009..d621a234b 100644 --- a/common/oatbox/BasicRegistry.php +++ b/common/oatbox/BasicRegistry.php @@ -21,7 +21,7 @@ namespace oat\oatbox; -use \common_ext_ExtensionsManager; +use common_ext_ExtensionsManager; /** * Simple Registry for testing purpose @@ -38,7 +38,7 @@ protected function getConfigId() { return 'basic_registry'; } - + /** * * @see \oat\oatbox\AbstractRegistry::getExtension() diff --git a/common/oatbox/PhpSerializable.php b/common/oatbox/PhpSerializable.php index a8e644e8a..61be5e9d8 100644 --- a/common/oatbox/PhpSerializable.php +++ b/common/oatbox/PhpSerializable.php @@ -19,9 +19,9 @@ * * */ - + namespace oat\oatbox; - + /** * This interface means that the class can serialize instances * into executable code snippets diff --git a/common/oatbox/PhpSerializeStateless.php b/common/oatbox/PhpSerializeStateless.php index 5e02eb1e9..f13ee5c4d 100644 --- a/common/oatbox/PhpSerializeStateless.php +++ b/common/oatbox/PhpSerializeStateless.php @@ -19,9 +19,9 @@ * * */ - + namespace oat\oatbox; - + /** * Trait to serialize stateless instances * diff --git a/common/oatbox/action/ActionService.php b/common/oatbox/action/ActionService.php index ea2760a70..a2974480d 100644 --- a/common/oatbox/action/ActionService.php +++ b/common/oatbox/action/ActionService.php @@ -27,10 +27,10 @@ class ActionService extends ConfigurableService { - const SERVICE_ID = 'generis/actionService'; - - static $blackList = ['\\oatbox\\composer\\ExtensionInstaller','\\oatbox\\composer\\ExtensionInstallerPlugin']; - + public const SERVICE_ID = 'generis/actionService'; + + public static $blackList = ['\\oatbox\\composer\\ExtensionInstaller','\\oatbox\\composer\\ExtensionInstallerPlugin']; + /** * * @param string $actionIdentifier @@ -49,7 +49,7 @@ public function resolve($actionIdentifier) } return $action; } - + public function getAvailableActions() { $actions = $this->getCache()->get(__FUNCTION__); @@ -63,12 +63,12 @@ public function getAvailableActions() } return $actions; } - + protected function getCache(): SimpleCache { return $this->getServiceLocator()->get(SimpleCache::SERVICE_ID); } - + protected function getActionsInDirectory($dir) { $classNames = []; diff --git a/common/oatbox/action/Help.php b/common/oatbox/action/Help.php index 8e0a13461..1f0683242 100644 --- a/common/oatbox/action/Help.php +++ b/common/oatbox/action/Help.php @@ -28,7 +28,7 @@ class Help implements Action, ServiceLocatorAwareInterface { use ServiceLocatorAwareTrait; - + public function __invoke($params) { $actionResolver = $this->getServiceLocator()->get(ActionService::SERVICE_ID); diff --git a/common/oatbox/cache/KeyValueCache.php b/common/oatbox/cache/KeyValueCache.php index f6eeefabd..666597fda 100644 --- a/common/oatbox/cache/KeyValueCache.php +++ b/common/oatbox/cache/KeyValueCache.php @@ -39,7 +39,7 @@ class KeyValueCache extends ConfigurableService implements SimpleCache { use MultipleCacheTrait; - const OPTION_PERSISTENCE = 'persistence'; + public const OPTION_PERSISTENCE = 'persistence'; /** @var common_persistence_KeyValuePersistence */ private $persistence; @@ -82,7 +82,7 @@ public function has($key) protected function dateIntervalToSeconds(DateInterval $dateInterval): int { - $reference = new DateTimeImmutable; + $reference = new DateTimeImmutable(); $endTime = $reference->add($dateInterval); return $endTime->getTimestamp() - $reference->getTimestamp(); } diff --git a/common/oatbox/cache/MultipleCacheTrait.php b/common/oatbox/cache/MultipleCacheTrait.php index ffdef36a9..603d8cfe2 100644 --- a/common/oatbox/cache/MultipleCacheTrait.php +++ b/common/oatbox/cache/MultipleCacheTrait.php @@ -30,7 +30,6 @@ */ trait MultipleCacheTrait { - public function deleteMultiple($keys) { $success = true; @@ -57,5 +56,4 @@ public function setMultiple($values, $ttl = null) } return $success; } - } diff --git a/common/oatbox/cache/SetupFileCache.php b/common/oatbox/cache/SetupFileCache.php index dabd7af03..f542811e9 100644 --- a/common/oatbox/cache/SetupFileCache.php +++ b/common/oatbox/cache/SetupFileCache.php @@ -1,4 +1,5 @@ setOption($key, $option); } - + /** * Removes a specific field of an option * @@ -65,7 +65,7 @@ public function hashRemove($key, $field) return $this->setOption($key, $option); } } - + /** * Returns a specific field of an option * diff --git a/common/oatbox/config/ConfigurationDriver.php b/common/oatbox/config/ConfigurationDriver.php index ccdda91f2..3706c617a 100644 --- a/common/oatbox/config/ConfigurationDriver.php +++ b/common/oatbox/config/ConfigurationDriver.php @@ -23,5 +23,4 @@ interface ConfigurationDriver extends \common_persistence_KvDriver { - } diff --git a/common/oatbox/config/ConfigurationService.php b/common/oatbox/config/ConfigurationService.php index 25726d8b4..9a839a44e 100644 --- a/common/oatbox/config/ConfigurationService.php +++ b/common/oatbox/config/ConfigurationService.php @@ -32,7 +32,7 @@ */ class ConfigurationService extends ConfigurableService { - const OPTION_CONFIG = 'config'; + public const OPTION_CONFIG = 'config'; /** * @var string Documentation header diff --git a/common/oatbox/event/Event.php b/common/oatbox/event/Event.php index 55def2fdb..3521b994b 100644 --- a/common/oatbox/event/Event.php +++ b/common/oatbox/event/Event.php @@ -20,7 +20,7 @@ */ namespace oat\oatbox\event; - + /** * event interface * @author Joel Bout diff --git a/common/oatbox/event/EventManager.php b/common/oatbox/event/EventManager.php index 2ecebcb4a..29542f3a5 100644 --- a/common/oatbox/event/EventManager.php +++ b/common/oatbox/event/EventManager.php @@ -30,15 +30,15 @@ */ class EventManager extends ConfigurableService { - const SERVICE_ID = 'generis/event'; + public const SERVICE_ID = 'generis/event'; /** * @deprecated use SERVICE_ID */ - const CONFIG_ID = 'generis/event'; - - const OPTION_LISTENERS = 'listeners'; - + public const CONFIG_ID = 'generis/event'; + + public const OPTION_LISTENERS = 'listeners'; + /** * Dispatch an event and trigger its listeners * @@ -67,7 +67,7 @@ public function trigger($event, $params = []) call_user_func($callback, $event); } } - + /** * Attach a Listener to one or multiple events * @@ -90,7 +90,7 @@ public function attach($event, $callback) } $this->setOption(self::OPTION_LISTENERS, $listeners); } - + /** * remove listener from an event and delete event if it dosn't have any listeners * @param array $listeners @@ -130,7 +130,7 @@ public function detach($event, $callback) } $this->setOption(self::OPTION_LISTENERS, $listeners); } - + /** * Get all Listeners listening to this kind of event * diff --git a/common/oatbox/event/GenericEvent.php b/common/oatbox/event/GenericEvent.php index 6a5e63bc7..06af831c5 100644 --- a/common/oatbox/event/GenericEvent.php +++ b/common/oatbox/event/GenericEvent.php @@ -20,7 +20,7 @@ */ namespace oat\oatbox\event; - + use common_ext_ExtensionsManager; /** @@ -42,7 +42,7 @@ class GenericEvent implements Event * @var array() */ private $params; - + /** * Create a new generic event based on an event name * with optional parameters @@ -55,7 +55,7 @@ public function __construct($eventName, $params = []) $this->eventName = (string)$eventName; $this->params = $params; } - + /** * (non-PHPdoc) * @see \oat\oatbox\event\Event::getName() diff --git a/common/oatbox/extension/ComposerInfo.php b/common/oatbox/extension/ComposerInfo.php index a75d4f3e7..d58410751 100644 --- a/common/oatbox/extension/ComposerInfo.php +++ b/common/oatbox/extension/ComposerInfo.php @@ -57,7 +57,7 @@ public function __construct(string $rootDir = null) } else { $this->rootDir = $rootDir; } - $composerJsonPath = realpath($this->rootDir).DIRECTORY_SEPARATOR.self::COMPOSER_JSON; + $composerJsonPath = realpath($this->rootDir) . DIRECTORY_SEPARATOR . self::COMPOSER_JSON; if (!file_exists($composerJsonPath)) { throw new common_ext_ExtensionException(sprintf('Composer file missed at %s', $this->rootDir)); @@ -109,7 +109,7 @@ public function extractExtensionDependencies() /** * @return string */ - public function getPackageId():string + public function getPackageId(): string { return $this->getComposerJson()['name']; } @@ -130,7 +130,7 @@ private function getEncodedFileContent($path) private function getComposerJson(): array { if (!isset(self::$jsons[$this->rootDir])) { - $file = realpath($this->rootDir).DIRECTORY_SEPARATOR.self::COMPOSER_JSON; + $file = realpath($this->rootDir) . DIRECTORY_SEPARATOR . self::COMPOSER_JSON; self::$jsons[$this->rootDir] = $this->getEncodedFileContent($file); } return self::$jsons[$this->rootDir]; @@ -147,7 +147,7 @@ private function getComposerLock(): array return self::$locks[$this->rootDir]; } - $composerLockPath = realpath($this->rootDir).DIRECTORY_SEPARATOR.self::COMPOSER_LOCK; + $composerLockPath = realpath($this->rootDir) . DIRECTORY_SEPARATOR . self::COMPOSER_LOCK; if (!file_exists($composerLockPath)) { $composerLockPath = rtrim($this->getTaoRoot(), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . self::COMPOSER_LOCK; @@ -169,4 +169,4 @@ private function getTaoRoot(): string { return defined('ROOT_PATH') ? ROOT_PATH : realpath(__DIR__ . '/../../../../'); } -} \ No newline at end of file +} diff --git a/common/oatbox/extension/InstallAction.php b/common/oatbox/extension/InstallAction.php index 3408dbdaa..bfbe469ca 100644 --- a/common/oatbox/extension/InstallAction.php +++ b/common/oatbox/extension/InstallAction.php @@ -31,7 +31,6 @@ */ abstract class InstallAction extends AbstractAction { - /** * Add a new event Listener * diff --git a/common/oatbox/extension/Manifest.php b/common/oatbox/extension/Manifest.php index 80bfd2f72..ac303e89d 100644 --- a/common/oatbox/extension/Manifest.php +++ b/common/oatbox/extension/Manifest.php @@ -1,4 +1,5 @@ version === null) { $packageId = $this->getComposerInfo()->getPackageId(); diff --git a/common/oatbox/extension/UninstallAction.php b/common/oatbox/extension/UninstallAction.php index 7a2f23dee..c5697658a 100644 --- a/common/oatbox/extension/UninstallAction.php +++ b/common/oatbox/extension/UninstallAction.php @@ -30,7 +30,6 @@ */ abstract class UninstallAction extends AbstractAction { - /** * remove event listener * @param mixed $event either an Event object or a string diff --git a/common/oatbox/extension/exception/MalformedManifestException.php b/common/oatbox/extension/exception/MalformedManifestException.php index 822879dae..ce1b3fcc7 100644 --- a/common/oatbox/extension/exception/MalformedManifestException.php +++ b/common/oatbox/extension/exception/MalformedManifestException.php @@ -1,4 +1,5 @@ optionName = $optionName; } - + public function getOptionName() { return $this->optionName; diff --git a/common/oatbox/extension/script/OptionContainer.php b/common/oatbox/extension/script/OptionContainer.php index 95f9a16a1..e4d4fa873 100644 --- a/common/oatbox/extension/script/OptionContainer.php +++ b/common/oatbox/extension/script/OptionContainer.php @@ -32,12 +32,12 @@ class OptionContainer * @var array */ protected $options; - + /** * @var array */ protected $data; - + /** * Constructor * @@ -51,7 +51,7 @@ public function __construct(array $options, array $values) $this->data = self::extract($options, $values); $this->options = $options; } - + /** * Has Option * @@ -63,7 +63,7 @@ public function has($optionName) { return isset($this->data[$optionName]); } - + /** * Get Option * @@ -76,7 +76,7 @@ public function get($optionName) { return ($this->has($optionName)) ? $this->data[$optionName] : null; } - + /** * Get Options * @@ -88,7 +88,7 @@ public function getOptions() { return $this->options; } - + /** * Is Flag * @@ -98,21 +98,21 @@ public function isFlag($optionName) { return isset($this->options[$optionName]) && !empty($this->options[$optionName]['flag']); } - + private static function extract(array $options, array $values) { $returnValue = []; - + foreach ($options as $optionName => $optionParams) { // Ignore non string-indexed options. if (is_string($optionName)) { $prefix = empty($optionParams['prefix']) ? '' : $optionParams['prefix']; $longPrefix = empty($optionParams['longPrefix']) ? '' : $optionParams['longPrefix']; - + if (empty($prefix) && empty($longPrefix)) { throw new \LogicException("Argument with name '${optionName}' has no prefix, nor long prefix."); } - + if (!empty($optionParams['flag'])) { // It's a flag! if (is_int(self::searchOptionIndex($prefix, $longPrefix, $values))) { @@ -123,11 +123,11 @@ private static function extract(array $options, array $values) $required = empty($optionParams['required']) ? false : true; $castTo = empty($optionParams['cast']) ? null : $optionParams['cast']; $optionIndex = self::searchOptionIndex($prefix, $longPrefix, $values); - + if ($required && $optionIndex === false) { throw new MissingOptionException("Required argument '${optionName}' is missing.", $optionName); } - + if ($optionIndex === false && isset($optionParams['defaultValue'])) { $returnValue[$optionName] = self::cast($optionParams['defaultValue'], $castTo); } else { @@ -146,15 +146,15 @@ private static function extract(array $options, array $values) } } } - + return $returnValue; } - + private static function searchOptionIndex($prefix, $longPrefix, array $values) { $optionIndex = false; $prefixes = [$prefix, $longPrefix]; - + for ($i = 0; $i < count($prefixes); $i++) { $dashes = str_repeat('-', $i + 1); $p = $prefixes[$i]; @@ -165,36 +165,36 @@ private static function searchOptionIndex($prefix, $longPrefix, array $values) } } } - + return $optionIndex; } - + private static function cast($value, $to) { $casted = $value; - + if (is_string($to)) { switch (strtolower($to)) { case 'integer': case 'int': $casted = @intval($value); break; - + case 'float': $casted = @floatval($value); break; - + case 'string': $casted = @strval($value); break; - + case 'boolean': case 'bool': $casted = @boolval($value); break; } } - + return $casted; } } diff --git a/common/oatbox/extension/script/ScriptAction.php b/common/oatbox/extension/script/ScriptAction.php index 6d91de621..afca61a69 100644 --- a/common/oatbox/extension/script/ScriptAction.php +++ b/common/oatbox/extension/script/ScriptAction.php @@ -33,11 +33,11 @@ abstract class ScriptAction extends AbstractAction { private $options; private $optionsDescription; - + abstract protected function provideOptions(); - + abstract protected function provideDescription(); - + /** * Run Script. * @@ -47,7 +47,7 @@ abstract protected function provideDescription(); * @return \common_report_Report */ abstract protected function run(); - + /** * Invoke * @@ -59,12 +59,12 @@ public function __invoke($params) { $this->optionsDescription = $this->provideOptions(); $beginScript = microtime(true); - + // Display help? if ($this->displayUsage($params)) { return $this->usage(); } - + // Build option container. try { $this->options = new OptionContainer( @@ -98,17 +98,17 @@ protected function hasOption($optionName) { return $this->options->has($optionName); } - + protected function getOption($optionName) { return $this->options->get($optionName); } - + protected function provideUsage() { return []; } - + protected function provideUsageOptionName() { return 'help'; @@ -118,11 +118,11 @@ protected function showTime() { return false; } - + private function displayUsage(array $params) { $usageDescription = $this->provideUsage(); - + if (!empty($usageDescription) && is_array($usageDescription)) { if (!empty($usageDescription['prefix']) && in_array('-' . $usageDescription['prefix'], $params)) { return true; @@ -130,49 +130,49 @@ private function displayUsage(array $params) return true; } } - + return false; } - + private function usage() { $report = new Report( Report::TYPE_INFO, $this->provideDescription() . "\n" ); - + $optionsDescription = $this->optionsDescription; $optionsDescription[$this->provideUsageOptionName()] = $this->provideUsage(); - + $required = new Report(Report::TYPE_INFO, 'Required Arguments:'); $optional = new Report(Report::TYPE_INFO, 'Optional Arguments:'); - + foreach ($optionsDescription as $optionName => $optionParams) { // Deal with prefixes. $prefixes = []; $optionDisplay = (!empty($optionParams['flag'])) ? '' : " ${optionName}"; - + if (!empty($optionParams['prefix'])) { $prefixes[] = '-' . $optionParams['prefix'] . "${optionDisplay}"; } - + if (!empty($optionParams['longPrefix'])) { $prefixes[] = '--' . $optionParams['longPrefix'] . "${optionDisplay}"; } - + $optionMsg = implode(', ', $prefixes); if (isset($optionParams['defaultValue'])) { $optionMsg .= ' (default: ' . self::valueToString($optionParams['defaultValue']) . ')'; } - + $optionReport = new Report(Report::TYPE_INFO, $optionMsg); - + if (!empty($optionParams['description'])) { $optionReport->add( new Report(Report::TYPE_INFO, $optionParams['description']) ); } - + $targetReport = (empty($optionParams['required'])) ? $optional : $required; $targetReport->add($optionReport); } @@ -193,21 +193,21 @@ private function usage() return $report; } - + private static function valueToString($value) { $string = "\"${value}\""; - + switch (gettype($value)) { case 'boolean': $string = ($value === true) ? 'true' : 'false'; break; - + case 'integer': case 'double': $string = $value; } - + return $string; } diff --git a/common/oatbox/filesystem/Directory.php b/common/oatbox/filesystem/Directory.php index 87c746dbb..1b836afff 100644 --- a/common/oatbox/filesystem/Directory.php +++ b/common/oatbox/filesystem/Directory.php @@ -25,9 +25,9 @@ class Directory extends FileSystemHandler implements \IteratorAggregate { - const ITERATOR_RECURSIVE = '1'; - const ITERATOR_FILE = '2'; - const ITERATOR_DIRECTORY = '4'; + public const ITERATOR_RECURSIVE = '1'; + public const ITERATOR_FILE = '2'; + public const ITERATOR_DIRECTORY = '4'; /** * Get a subDirectory of $this (existing or not) @@ -167,13 +167,13 @@ public function rename($path) // implementation is then needed. $contents = $this->getFileSystem()->listContents($this->getPrefix(), true); - $fileSystemId = $this->getFileSystemId().'/'; + $fileSystemId = $this->getFileSystemId() . '/'; // Filter files only. $filePaths = []; foreach ($contents as $content) { if ($content['type'] === 'file') { $contentPath = $content['path']; - if(strpos($contentPath, $fileSystemId) === 0) { + if (strpos($contentPath, $fileSystemId) === 0) { $contentPath = substr($contentPath, strlen($fileSystemId)); } @@ -186,10 +186,10 @@ public function rename($path) foreach ($filePaths as $renaming) { try { if ($this->getFileSystem()->rename($renaming['source'], $renaming['destination']) === false) { - throw new \common_exception_FileSystemError("Unable to rename '" . $renaming['source'] . "' into '".$renaming['destination']."'."); + throw new \common_exception_FileSystemError("Unable to rename '" . $renaming['source'] . "' into '" . $renaming['destination'] . "'."); } } catch (FileExistsException $e) { - throw new \common_exception_FileSystemError("Unable to rename '" . $renaming['source'] . "' into '".$renaming['destination']."'. File already exists."); + throw new \common_exception_FileSystemError("Unable to rename '" . $renaming['source'] . "' into '" . $renaming['destination'] . "'. File already exists."); } } diff --git a/common/oatbox/filesystem/FileSystemService.php b/common/oatbox/filesystem/FileSystemService.php index 558ea6cf7..eb5542d1d 100755 --- a/common/oatbox/filesystem/FileSystemService.php +++ b/common/oatbox/filesystem/FileSystemService.php @@ -25,25 +25,25 @@ use League\Flysystem\AdapterInterface; use common_exception_Error; use Zend\ServiceManager\ServiceLocatorAwareInterface; -use \League\Flysystem\Filesystem as FlyFileSystem; +use League\Flysystem\Filesystem as FlyFileSystem; use League\Flysystem\FilesystemInterface; - /** - * A service to reference and retrieve filesystems - */ +/** +* A service to reference and retrieve filesystems +*/ class FileSystemService extends ConfigurableService { - const SERVICE_ID = 'generis/filesystem'; + public const SERVICE_ID = 'generis/filesystem'; - const OPTION_FILE_PATH = 'filesPath'; + public const OPTION_FILE_PATH = 'filesPath'; - const OPTION_ADAPTERS = 'adapters'; + public const OPTION_ADAPTERS = 'adapters'; - const OPTION_DIRECTORIES = 'dirs'; + public const OPTION_DIRECTORIES = 'dirs'; - const FLYSYSTEM_ADAPTER_NS = '\\League\\Flysystem\\Adapter\\'; + public const FLYSYSTEM_ADAPTER_NS = '\\League\\Flysystem\\Adapter\\'; - const FLYSYSTEM_LOCAL_ADAPTER = 'Local'; + public const FLYSYSTEM_LOCAL_ADAPTER = 'Local'; private $filesystems = []; @@ -79,7 +79,7 @@ protected function addDir($id, $adapterId) $dirs[$id] = $adapterId; $this->setOption(self::OPTION_DIRECTORIES, $dirs); } - + /** * Returns whenever or not a FS exists * @param string $id @@ -111,7 +111,7 @@ public function getFileSystem($id) } return $this->filesystems[$id]; } - + /** * Creates a filesystem using the default implementation (Local) * Override this function to create your files elsewhere by default @@ -139,7 +139,7 @@ public function createLocalFileSystem($id) $this->registerLocalFileSystem($id, $path); return $this->getFileSystem($id); } - + /** * Registers a local file system, used for transition * diff --git a/common/oatbox/filesystem/utils/FlyWrapperTrait.php b/common/oatbox/filesystem/utils/FlyWrapperTrait.php index ad68049ec..5a727b3ac 100644 --- a/common/oatbox/filesystem/utils/FlyWrapperTrait.php +++ b/common/oatbox/filesystem/utils/FlyWrapperTrait.php @@ -12,7 +12,6 @@ */ trait FlyWrapperTrait { - /** * (non-PHPdoc) * @see \League\Flysystem\AdapterInterface::write() @@ -21,7 +20,7 @@ public function write($path, $contents, Config $config) { return $this->getAdapter()->write($path, $contents, $config); } - + /** * (non-PHPdoc) * @see \League\Flysystem\AdapterInterface::writeStream() @@ -30,7 +29,7 @@ public function writeStream($path, $resource, Config $config) { return $this->getAdapter()->writeStream($path, $resource, $config); } - + /** * (non-PHPdoc) * @see \League\Flysystem\AdapterInterface::update() @@ -39,7 +38,7 @@ public function update($path, $contents, Config $config) { return $this->getAdapter()->update($path, $contents, $config); } - + /** * (non-PHPdoc) * @see \League\Flysystem\AdapterInterface::updateStream() @@ -48,7 +47,7 @@ public function updateStream($path, $resource, Config $config) { return $this->getAdapter()->updateStream($path, $resource, $config); } - + /** * (non-PHPdoc) * @see \League\Flysystem\AdapterInterface::rename() @@ -57,7 +56,7 @@ public function rename($path, $newpath) { return $this->getAdapter()->rename($path, $newpath); } - + /** * (non-PHPdoc) * @see \League\Flysystem\AdapterInterface::copy() @@ -66,7 +65,7 @@ public function copy($path, $newpath) { $this->getAdapter()->copy($path, $newpath); } - + /** * (non-PHPdoc) * @see \League\Flysystem\AdapterInterface::delete() @@ -75,7 +74,7 @@ public function delete($path) { return $this->getAdapter()->delete($path); } - + /** * (non-PHPdoc) * @see \League\Flysystem\AdapterInterface::deleteDir() @@ -84,7 +83,7 @@ public function deleteDir($dirname) { return $this->getAdapter()->deleteDir($dirname); } - + /** * (non-PHPdoc) * @see \League\Flysystem\AdapterInterface::createDir() @@ -93,7 +92,7 @@ public function createDir($dirname, Config $config) { return $this->getAdapter()->createDir($dirname, $config); } - + /** * (non-PHPdoc) * @see \League\Flysystem\AdapterInterface::setVisibility() @@ -102,7 +101,7 @@ public function setVisibility($path, $visibility) { return $this->getAdapter()->setVisibility($path, $visibility); } - + /** * (non-PHPdoc) * @see \League\Flysystem\ReadInterface::has() @@ -111,7 +110,7 @@ public function has($path) { return $this->getAdapter()->has($path); } - + /** * (non-PHPdoc) * @see \League\Flysystem\ReadInterface::read() @@ -120,7 +119,7 @@ public function read($path) { return $this->getAdapter()->read($path); } - + /** * (non-PHPdoc) * @see \League\Flysystem\ReadInterface::readStream() @@ -129,7 +128,7 @@ public function readStream($path) { return $this->getAdapter()->readStream($path); } - + /** * (non-PHPdoc) * @see \League\Flysystem\ReadInterface::listContents() @@ -138,7 +137,7 @@ public function listContents($directory = '', $recursive = false) { return $this->getAdapter()->listContents($directory, $recursive); } - + /** * (non-PHPdoc) * @see \League\Flysystem\ReadInterface::getMetadata() @@ -147,7 +146,7 @@ public function getMetadata($path) { return $this->getAdapter()->getMetadata($path); } - + /** * (non-PHPdoc) * @see \League\Flysystem\ReadInterface::getSize() @@ -156,7 +155,7 @@ public function getSize($path) { return $this->getAdapter()->getSize($path); } - + /** * (non-PHPdoc) * @see \League\Flysystem\ReadInterface::getMimetype() @@ -165,7 +164,7 @@ public function getMimetype($path) { return $this->getAdapter()->getMimetype($path); } - + /** * (non-PHPdoc) * @see \League\Flysystem\ReadInterface::getTimestamp() @@ -174,7 +173,7 @@ public function getTimestamp($path) { return $this->getAdapter()->getTimestamp($path); } - + /** * (non-PHPdoc) * @see \League\Flysystem\ReadInterface::getVisibility() @@ -183,7 +182,7 @@ public function getVisibility($path) { return $this->getAdapter()->getVisibility($path); } - + /** * Return the adapter implementation * diff --git a/common/oatbox/filesystem/wrapper/GoogleStorageWrapper.php b/common/oatbox/filesystem/wrapper/GoogleStorageWrapper.php index 8b290aea2..c29847a9f 100644 --- a/common/oatbox/filesystem/wrapper/GoogleStorageWrapper.php +++ b/common/oatbox/filesystem/wrapper/GoogleStorageWrapper.php @@ -35,13 +35,13 @@ class GoogleStorageWrapper extends ConfigurableService implements AdapterInterfa { use FlyWrapperTrait; use LoggerAwareTrait; - - const OPTION_BUCKET = 'bucket'; - const OPTION_CLIENT_CONFIG = 'clientConfig'; + public const OPTION_BUCKET = 'bucket'; + + public const OPTION_CLIENT_CONFIG = 'clientConfig'; private $adapter; - + /** * @return StorageClient */ @@ -49,7 +49,7 @@ private function getClient() { return new StorageClient($this->getOption(self::OPTION_CLIENT_CONFIG)); } - + /** * @return AdapterInterface */ diff --git a/common/oatbox/install/Installer.php b/common/oatbox/install/Installer.php index fbfb21eb5..ff712b964 100755 --- a/common/oatbox/install/Installer.php +++ b/common/oatbox/install/Installer.php @@ -40,7 +40,6 @@ */ class Installer extends ConfigurableService { - /** * run the install */ diff --git a/common/oatbox/log/LoggerAggregator.php b/common/oatbox/log/LoggerAggregator.php index 07faaad0c..1a6fa7fbc 100644 --- a/common/oatbox/log/LoggerAggregator.php +++ b/common/oatbox/log/LoggerAggregator.php @@ -59,7 +59,7 @@ public function __construct($options = []) $this->loggers = $this->getOptions(); } - + /** * (non-PHPdoc) * @see \Psr\Log\LoggerInterface::log() diff --git a/common/oatbox/log/LoggerAwareTrait.php b/common/oatbox/log/LoggerAwareTrait.php index 986305068..605c68480 100755 --- a/common/oatbox/log/LoggerAwareTrait.php +++ b/common/oatbox/log/LoggerAwareTrait.php @@ -64,7 +64,7 @@ public function getLogger() } // Helpers - + /** * Logs an emergency * @@ -75,37 +75,37 @@ public function logEmergency($message, $context = []) { $this->getLogger()->emergency($message, $context); } - + public function logAlert($message, $context = []) { $this->getLogger()->alert($message, $context); } - + public function logCritical($message, $context = []) { $this->getLogger()->critical($message, $context); } - + public function logError($message, $context = []) { $this->getLogger()->error($message, $context); } - + public function logWarning($message, $context = []) { $this->getLogger()->warning($message, $context); } - + public function logNotice($message, $context = []) { $this->getLogger()->notice($message, $context); } - + public function logInfo($message, $context = []) { $this->getLogger()->info($message, $context); } - + public function logDebug($message, $context = []) { $this->getLogger()->debug($message, $context); diff --git a/common/oatbox/log/LoggerService.php b/common/oatbox/log/LoggerService.php index 1c9cce6f1..ef348dce9 100644 --- a/common/oatbox/log/LoggerService.php +++ b/common/oatbox/log/LoggerService.php @@ -30,9 +30,9 @@ class LoggerService extends ConfigurableService implements LoggerInterface { use LoggerTrait; - const SERVICE_ID = 'generis/log'; + public const SERVICE_ID = 'generis/log'; - const LOGGER_OPTION = 'logger'; + public const LOGGER_OPTION = 'logger'; /** @var LoggerInterface */ protected $logger; diff --git a/common/oatbox/log/logger/TaoLog.php b/common/oatbox/log/logger/TaoLog.php index 3c9dc37f1..f36108d8b 100644 --- a/common/oatbox/log/logger/TaoLog.php +++ b/common/oatbox/log/logger/TaoLog.php @@ -37,7 +37,7 @@ class TaoLog extends ConfigurableService implements LoggerInterface { use LoggerTrait; - const OPTION_APPENDERS = 'appenders'; + public const OPTION_APPENDERS = 'appenders'; /** @var \common_log_Dispatcher */ private $dispatcher; @@ -79,7 +79,7 @@ public function log($level, $message, array $context = []) } else { $requestURI = implode(' ', $_SERVER['argv']); } - + //reformat input if (is_object($message)) { $message = 'Message is object of type ' . gettype($message); @@ -88,7 +88,7 @@ public function log($level, $message, array $context = []) if ($level <= \common_Logger::DEBUG_LEVEL) { $message .= ' : ' . PHP_EOL . var_export($message, true); } - //same for arrays + //same for arrays } elseif (is_array($message) && $level <= \common_Logger::DEBUG_LEVEL) { $message = 'Message is an array : ' . PHP_EOL . var_export($message, true); } else { @@ -97,7 +97,7 @@ public function log($level, $message, array $context = []) $level = \common_log_Logger2Psr::getCommonFromPsrLevel($level); $this->getDispatcher()->log(new \common_log_Item($message, $level, time(), $stack, $context, $requestURI, $errorFile, $errorLine)); } - + /** * Returns the dispatcher * diff --git a/common/oatbox/log/logger/TaoMonolog.php b/common/oatbox/log/logger/TaoMonolog.php index af3fffb05..a35640a59 100644 --- a/common/oatbox/log/logger/TaoMonolog.php +++ b/common/oatbox/log/logger/TaoMonolog.php @@ -41,7 +41,7 @@ class TaoMonolog extends ConfigurableService implements LoggerInterface { use LoggerTrait; - const HANDLERS_OPTION = 'handlers'; + public const HANDLERS_OPTION = 'handlers'; /** @var Logger null */ protected $logger = null; diff --git a/common/oatbox/log/logger/formatter/CloudWatchJsonFormatter.php b/common/oatbox/log/logger/formatter/CloudWatchJsonFormatter.php index 3f729a94a..51a06e1bf 100644 --- a/common/oatbox/log/logger/formatter/CloudWatchJsonFormatter.php +++ b/common/oatbox/log/logger/formatter/CloudWatchJsonFormatter.php @@ -30,11 +30,10 @@ */ class CloudWatchJsonFormatter implements FormatterInterface { - /** * Used datetime format. */ - const DATETIME_FORMAT = 'd/m/Y:H:i:s O'; + public const DATETIME_FORMAT = 'd/m/Y:H:i:s O'; /** * @inheritdoc @@ -82,7 +81,7 @@ protected function getOutputRecord(array $record) 'message' => $record['message'], 'tag' => $record['context'], ]; - + if (isset($record['extra']['stack']['host_type'])) { $output['host_type'] = $record['extra']['stack']['host_type']; } diff --git a/common/oatbox/log/logger/formatter/TaoJsonLogFormatter.php b/common/oatbox/log/logger/formatter/TaoJsonLogFormatter.php index ca75ac892..fe906725d 100644 --- a/common/oatbox/log/logger/formatter/TaoJsonLogFormatter.php +++ b/common/oatbox/log/logger/formatter/TaoJsonLogFormatter.php @@ -35,42 +35,42 @@ class TaoJsonLogFormatter implements FormatterInterface /** * Used datetime format. */ - const DATETIME_FORMAT = 'd/m/Y:H:i:s O'; + public const DATETIME_FORMAT = 'd/m/Y:H:i:s O'; /** * Datetime offset in the generated output. */ - const DATETIME_OFFSET = 'datetime'; + public const DATETIME_OFFSET = 'datetime'; /** * Stack offset in the generated output. */ - const STACK_OFFSET = 'stack'; + public const STACK_OFFSET = 'stack'; /** * Severity offset in the generated output. */ - const SEVERITY_OFFSET = 'severity'; + public const SEVERITY_OFFSET = 'severity'; /** * Line offset in the generated output. */ - const LINE_OFFSET = 'line'; + public const LINE_OFFSET = 'line'; /** * File offset in the generated output. */ - const FILE_OFFSET = 'file'; + public const FILE_OFFSET = 'file'; /** * Content/message offset in the generated output. */ - const CONTENT_OFFSET = 'content'; + public const CONTENT_OFFSET = 'content'; /** * Backtrace offset in the generated output. */ - const TRACE_OFFSET = 'trace'; + public const TRACE_OFFSET = 'trace'; /** * @inheritdoc diff --git a/common/oatbox/log/logger/processor/BacktraceProcessor.php b/common/oatbox/log/logger/processor/BacktraceProcessor.php index d7d14800b..c08be1a9f 100644 --- a/common/oatbox/log/logger/processor/BacktraceProcessor.php +++ b/common/oatbox/log/logger/processor/BacktraceProcessor.php @@ -37,7 +37,7 @@ class BacktraceProcessor /** * Trace offset name under the log extra offset. */ - const TRACE_OFFSET = 'trace'; + public const TRACE_OFFSET = 'trace'; /** * @var array diff --git a/common/oatbox/log/logger/processor/EnvironmentProcessor.php b/common/oatbox/log/logger/processor/EnvironmentProcessor.php index 586e0c38d..b1174716b 100644 --- a/common/oatbox/log/logger/processor/EnvironmentProcessor.php +++ b/common/oatbox/log/logger/processor/EnvironmentProcessor.php @@ -31,22 +31,22 @@ class EnvironmentProcessor extends EnvironmentProcessorAbstract /** * Environment variable name for stack identifier. */ - const ENV_STACK_ID = 'STACK_ID'; + public const ENV_STACK_ID = 'STACK_ID'; /** * Environment variable name for stack name. */ - const ENV_STACK_NAME = 'STACK_NAME'; + public const ENV_STACK_NAME = 'STACK_NAME'; /** * Environment variable name for stack host type. */ - const ENV_STACK_HOST_TYPE = 'HOST_TYPE'; + public const ENV_STACK_HOST_TYPE = 'HOST_TYPE'; /** * Default stack type value. */ - const DEFAULT_STACK_TYPE = 'tao'; + public const DEFAULT_STACK_TYPE = 'tao'; /** * @inheritdoc diff --git a/common/oatbox/log/logger/processor/EnvironmentProcessorAbstract.php b/common/oatbox/log/logger/processor/EnvironmentProcessorAbstract.php index 71134b826..a929de671 100644 --- a/common/oatbox/log/logger/processor/EnvironmentProcessorAbstract.php +++ b/common/oatbox/log/logger/processor/EnvironmentProcessorAbstract.php @@ -33,27 +33,27 @@ abstract class EnvironmentProcessorAbstract /** * Stack offset name under the log extra offset. */ - const LOG_STACK = 'stack'; + public const LOG_STACK = 'stack'; /** * Stack identifier offset name under the stack offset. */ - const LOG_STACK_ID = 'id'; + public const LOG_STACK_ID = 'id'; /** * Stack type offset name under the stack offset. */ - const LOG_STACK_TYPE = 'type'; + public const LOG_STACK_TYPE = 'type'; /** * Client name offset name under the stack offset. */ - const LOG_STACK_NAME = 'name'; + public const LOG_STACK_NAME = 'name'; /** * Host type offset name under the stack offset. */ - const LOG_STACK_HOST_TYPE = 'host_type'; + public const LOG_STACK_HOST_TYPE = 'host_type'; /** * @var string diff --git a/common/oatbox/mutex/LockService.php b/common/oatbox/mutex/LockService.php index 14892e289..09c469051 100644 --- a/common/oatbox/mutex/LockService.php +++ b/common/oatbox/mutex/LockService.php @@ -40,9 +40,9 @@ */ class LockService extends ConfigurableService { - const SERVICE_ID = 'generis/LockService'; - const OPTION_PERSISTENCE_CLASS = 'persistence_class'; - const OPTION_PERSISTENCE_OPTIONS = 'persistence_options'; + public const SERVICE_ID = 'generis/LockService'; + public const OPTION_PERSISTENCE_CLASS = 'persistence_class'; + public const OPTION_PERSISTENCE_OPTIONS = 'persistence_options'; /** @var Factory */ private $factory; diff --git a/common/oatbox/reporting/RecursiveReportIterator.php b/common/oatbox/reporting/RecursiveReportIterator.php index 32fa37666..ec98908fa 100644 --- a/common/oatbox/reporting/RecursiveReportIterator.php +++ b/common/oatbox/reporting/RecursiveReportIterator.php @@ -1,4 +1,5 @@ getDefaultHeader($key) . PHP_EOL . "return " . common_Utils::toHumanReadablePhpString($value) . ";" . PHP_EOL; } - + /** * Generates a default header * @@ -54,7 +54,7 @@ private function getDefaultHeader($key) . ' * Default config header created during install' . PHP_EOL . ' */' . PHP_EOL; } - + /** * (non-PHPdoc) * @see common_persistence_PhpFileDriver::getPath() diff --git a/common/oatbox/service/exception/InvalidService.php b/common/oatbox/service/exception/InvalidService.php index 3e19351c6..9c1688b6d 100644 --- a/common/oatbox/service/exception/InvalidService.php +++ b/common/oatbox/service/exception/InvalidService.php @@ -26,5 +26,4 @@ */ class InvalidService extends \common_exception_InconsistentData { - } diff --git a/common/oatbox/service/exception/InvalidServiceManagerException.php b/common/oatbox/service/exception/InvalidServiceManagerException.php index 79b79bfb6..1edc1668e 100644 --- a/common/oatbox/service/exception/InvalidServiceManagerException.php +++ b/common/oatbox/service/exception/InvalidServiceManagerException.php @@ -30,5 +30,4 @@ */ class InvalidServiceManagerException extends \common_Exception { - } diff --git a/common/oatbox/session/SessionService.php b/common/oatbox/session/SessionService.php index 7ae82d00f..f318fc790 100755 --- a/common/oatbox/session/SessionService.php +++ b/common/oatbox/session/SessionService.php @@ -33,7 +33,7 @@ */ class SessionService extends ConfigurableService { - const SERVICE_ID = 'generis/session'; + public const SERVICE_ID = 'generis/session'; /** * Returns the currently active session diff --git a/common/oatbox/task/AbstractTask.php b/common/oatbox/task/AbstractTask.php index 9bced64a7..44e200952 100644 --- a/common/oatbox/task/AbstractTask.php +++ b/common/oatbox/task/AbstractTask.php @@ -33,7 +33,6 @@ */ abstract class AbstractTask implements Task, \JsonSerializable { - /** * @var string */ diff --git a/common/oatbox/task/AbstractTaskAction.php b/common/oatbox/task/AbstractTaskAction.php index 39edf217b..949db475c 100644 --- a/common/oatbox/task/AbstractTaskAction.php +++ b/common/oatbox/task/AbstractTaskAction.php @@ -34,8 +34,7 @@ */ abstract class AbstractTaskAction extends AbstractAction { - - const FILE_DIR = 'taskQueue'; + public const FILE_DIR = 'taskQueue'; /** * Save and serialize file into task queue filesystem. diff --git a/common/oatbox/task/Exception/BadTaskQueueOption.php b/common/oatbox/task/Exception/BadTaskQueueOption.php index 3e773dad2..3ee89d4eb 100644 --- a/common/oatbox/task/Exception/BadTaskQueueOption.php +++ b/common/oatbox/task/Exception/BadTaskQueueOption.php @@ -14,5 +14,4 @@ */ class BadTaskQueueOption extends \common_exception_Error { - } diff --git a/common/oatbox/task/Queue.php b/common/oatbox/task/Queue.php index 157874914..a272669ae 100644 --- a/common/oatbox/task/Queue.php +++ b/common/oatbox/task/Queue.php @@ -30,17 +30,17 @@ interface Queue extends \IteratorAggregate /** * @deprecated since 3.15.2 */ - const CONFIG_ID = 'generis/taskqueue'; + public const CONFIG_ID = 'generis/taskqueue'; /** * @deprecated since version 7.10.0, to be removed in 8.0. Use \oat\tao\model\taskQueue\QueueDispatcherInterface::SERVICE_ID instead. */ - const SERVICE_ID = 'generis/taskqueue'; + public const SERVICE_ID = 'generis/taskqueue'; /** * @deprecated since version 7.10.0, to be removed in 8.0. Use \oat\tao\model\taskQueue\QueueDispatcherInterface::FILE_SYSTEM_ID instead. */ - const FILE_SYSTEM_ID = 'taskQueueStorage'; + public const FILE_SYSTEM_ID = 'taskQueueStorage'; /** * @param $actionId diff --git a/common/oatbox/task/Task.php b/common/oatbox/task/Task.php index 4ad72f5c6..d9f45f696 100644 --- a/common/oatbox/task/Task.php +++ b/common/oatbox/task/Task.php @@ -26,15 +26,15 @@ */ interface Task { - const STATUS_CREATED = 'created'; - const STATUS_STARTED = 'started'; - const STATUS_RUNNING = 'running'; - const STATUS_FINISHED = 'finished'; - const STATUS_ARCHIVED = 'archived'; - - const TASK_CLASS = 'http://www.tao.lu/Ontologies/generis.rdf#TaskQueueTask'; - const PROPERTY_LINKED_RESOURCE = 'http://www.tao.lu/Ontologies/generis.rdf#LinkedResource'; - const PROPERTY_REPORT = 'http://www.tao.lu/Ontologies/generis.rdf#Report'; + public const STATUS_CREATED = 'created'; + public const STATUS_STARTED = 'started'; + public const STATUS_RUNNING = 'running'; + public const STATUS_FINISHED = 'finished'; + public const STATUS_ARCHIVED = 'archived'; + + public const TASK_CLASS = 'http://www.tao.lu/Ontologies/generis.rdf#TaskQueueTask'; + public const PROPERTY_LINKED_RESOURCE = 'http://www.tao.lu/Ontologies/generis.rdf#LinkedResource'; + public const PROPERTY_REPORT = 'http://www.tao.lu/Ontologies/generis.rdf#Report'; /** * @deprecated since version 7.10.0, to be removed in 8.0. diff --git a/common/oatbox/task/TaskInterface/TaskListIterator.php b/common/oatbox/task/TaskInterface/TaskListIterator.php index d2a5558a1..b7d7b28e1 100644 --- a/common/oatbox/task/TaskInterface/TaskListIterator.php +++ b/common/oatbox/task/TaskInterface/TaskListIterator.php @@ -26,7 +26,4 @@ */ interface TaskListIterator extends \Iterator, \Countable { - - - } diff --git a/common/oatbox/task/TaskInterface/TaskPayLoad.php b/common/oatbox/task/TaskInterface/TaskPayLoad.php index 99057561d..7b9562112 100644 --- a/common/oatbox/task/TaskInterface/TaskPayLoad.php +++ b/common/oatbox/task/TaskInterface/TaskPayLoad.php @@ -30,7 +30,6 @@ */ interface TaskPayLoad extends DatatablePayload, ServiceLocatorAwareInterface { - public function __construct(TaskPersistenceInterface $persistence, $currentUserId = null, DatatableRequestInterface $request = null); /** diff --git a/common/oatbox/task/TaskRunner.php b/common/oatbox/task/TaskRunner.php index 085b61944..bbf91b70c 100644 --- a/common/oatbox/task/TaskRunner.php +++ b/common/oatbox/task/TaskRunner.php @@ -20,11 +20,11 @@ */ namespace oat\oatbox\task; - + use oat\oatbox\action\ActionService; use oat\oatbox\task\TaskInterface\TaskQueue; use Zend\ServiceManager\ServiceLocatorAwareInterface; -use \oat\oatbox\task\TaskInterface\TaskRunner as TaskRunnerInterface; +use oat\oatbox\task\TaskInterface\TaskRunner as TaskRunnerInterface; use Zend\ServiceManager\ServiceLocatorAwareTrait; use common_report_Report as Report; diff --git a/common/oatbox/task/TaskService.php b/common/oatbox/task/TaskService.php index 807cc2dc8..10bb2d4e7 100644 --- a/common/oatbox/task/TaskService.php +++ b/common/oatbox/task/TaskService.php @@ -21,7 +21,7 @@ */ namespace oat\oatbox\task; - + use oat\oatbox\service\ConfigurableService; use common_report_Report as Report; @@ -33,12 +33,12 @@ class TaskService extends ConfigurableService /** * @deprecated since version 7.10.0, to be removed in 8.0. */ - const TASK_QUEUE_MANAGER_ROLE = 'http://www.tao.lu/Ontologies/TAO.rdf#TaskQueueManager'; + public const TASK_QUEUE_MANAGER_ROLE = 'http://www.tao.lu/Ontologies/TAO.rdf#TaskQueueManager'; /** * @deprecated since version 7.10.0, to be removed in 8.0. */ - const OPTION_LIMIT = 'limit'; + public const OPTION_LIMIT = 'limit'; /** @@ -65,7 +65,7 @@ public function runQueue() break; } } - + if (empty($statistics)) { $report = new Report(Report::TYPE_INFO, __('No tasks to run')); } else { diff --git a/common/oatbox/task/implementation/SyncQueue.php b/common/oatbox/task/implementation/SyncQueue.php index 271c1aef2..f8426b5d4 100644 --- a/common/oatbox/task/implementation/SyncQueue.php +++ b/common/oatbox/task/implementation/SyncQueue.php @@ -24,7 +24,7 @@ use oat\oatbox\task\AbstractQueue; use oat\oatbox\task\Task; use oat\oatbox\task\TaskRunner; -use \common_report_Report as Report; +use common_report_Report as Report; /** * Class SyncQueue @@ -45,7 +45,6 @@ */ class SyncQueue extends AbstractQueue { - /** * @var TaskRunner */ diff --git a/common/oatbox/task/implementation/SyncTask.php b/common/oatbox/task/implementation/SyncTask.php index fb0d12b6a..9b01b4606 100644 --- a/common/oatbox/task/implementation/SyncTask.php +++ b/common/oatbox/task/implementation/SyncTask.php @@ -37,5 +37,4 @@ */ class SyncTask extends AbstractTask { - } diff --git a/common/oatbox/task/implementation/TaskList.php b/common/oatbox/task/implementation/TaskList.php index dc7d100eb..e7c6cb407 100644 --- a/common/oatbox/task/implementation/TaskList.php +++ b/common/oatbox/task/implementation/TaskList.php @@ -28,5 +28,4 @@ */ class TaskList extends \ArrayIterator implements TaskListIterator { - } diff --git a/common/oatbox/user/AnonymousUser.php b/common/oatbox/user/AnonymousUser.php index f6e52ca2a..c73d6d7df 100644 --- a/common/oatbox/user/AnonymousUser.php +++ b/common/oatbox/user/AnonymousUser.php @@ -34,7 +34,7 @@ public function getIdentifier() { return null; } - + /** * (non-PHPdoc) * @see \oat\oatbox\user\User::getRoles() @@ -43,7 +43,7 @@ public function getRoles() { return [GenerisRdf::INSTANCE_ROLE_ANONYMOUS]; } - + /** * (non-PHPdoc) * @see \oat\oatbox\user\User::getPropertyValues() diff --git a/common/oatbox/user/LoginFailedException.php b/common/oatbox/user/LoginFailedException.php index a398a0707..d5f86a261 100644 --- a/common/oatbox/user/LoginFailedException.php +++ b/common/oatbox/user/LoginFailedException.php @@ -33,12 +33,12 @@ class LoginFailedException extends common_user_auth_AuthFailedException { private $exceptions; - + public function __construct(array $exceptions) { $this->exceptions = $exceptions; } - + /** * (non-PHPdoc) * @see common_exception_UserReadableException::getUserMessage() diff --git a/common/oatbox/user/LoginService.php b/common/oatbox/user/LoginService.php index 2bd1cdc31..311515a91 100755 --- a/common/oatbox/user/LoginService.php +++ b/common/oatbox/user/LoginService.php @@ -55,7 +55,7 @@ public static function login($userLogin, $userPassword) } return $loggedIn; } - + /** * * @param string $userLogin @@ -66,7 +66,7 @@ public static function login($userLogin, $userPassword) public static function authenticate($userLogin, $userPassword) { $user = null; - + $adapters = AuthFactory::createAdapters(); $exceptions = []; while (!empty($adapters) && is_null($user)) { @@ -86,8 +86,8 @@ public static function authenticate($userLogin, $userPassword) throw new LoginFailedException($exceptions); } } - - + + /** * Start a session for a provided user * diff --git a/common/oatbox/user/User.php b/common/oatbox/user/User.php index 012b80ac3..7b6dec3ff 100644 --- a/common/oatbox/user/User.php +++ b/common/oatbox/user/User.php @@ -30,7 +30,7 @@ interface User * @return string */ public function getIdentifier(); - + /** * Extends the users explizit roles with the implizit rules * of the local system @@ -38,7 +38,7 @@ public function getIdentifier(); * @return array the identifiers of the roles: */ public function getRoles(); - + /** * Retrieve custom attributes of a user * diff --git a/common/oatbox/user/UserLanguageServiceInterface.php b/common/oatbox/user/UserLanguageServiceInterface.php index 81c948dd0..35415376c 100644 --- a/common/oatbox/user/UserLanguageServiceInterface.php +++ b/common/oatbox/user/UserLanguageServiceInterface.php @@ -27,8 +27,7 @@ */ interface UserLanguageServiceInterface { - - const SERVICE_ID = 'generis/UserLanguageService'; + public const SERVICE_ID = 'generis/UserLanguageService'; /** * @return string language code (e.g. 'en-US') diff --git a/common/oatbox/user/UserService.php b/common/oatbox/user/UserService.php index 749f3a8e5..5d1fe75df 100644 --- a/common/oatbox/user/UserService.php +++ b/common/oatbox/user/UserService.php @@ -23,7 +23,7 @@ interface UserService { - const SERVICE_ID = 'generis/UserService'; + public const SERVICE_ID = 'generis/UserService'; /** * Will return the list of the first X users matching the search string diff --git a/common/oatbox/user/UserTimezoneService.php b/common/oatbox/user/UserTimezoneService.php index 63d76bd7d..a7a45b682 100644 --- a/common/oatbox/user/UserTimezoneService.php +++ b/common/oatbox/user/UserTimezoneService.php @@ -1,4 +1,5 @@ evaluate($value); } - + /** * return all errors * @return array diff --git a/common/oatbox/validator/ValidatorInterface.php b/common/oatbox/validator/ValidatorInterface.php index 937875d13..f66c60f8c 100644 --- a/common/oatbox/validator/ValidatorInterface.php +++ b/common/oatbox/validator/ValidatorInterface.php @@ -27,39 +27,38 @@ */ interface ValidatorInterface { - /** * return validator name * @return string */ public function getName(); - + /** * return validator options * @return array */ public function getOptions(); - + /** * return error message * @return string */ public function getMessage(); - + /** * set up error message * @param string $message * @return $this */ public function setMessage($message); - + /** * set up validator options * @param array $options * @return $this */ public function setOptions(array $options); - + /** * valid $values * @param string $values diff --git a/common/persistence/EnvironmentVariableKVDriver.php b/common/persistence/EnvironmentVariableKVDriver.php index ac20070b1..aa1ff49fc 100644 --- a/common/persistence/EnvironmentVariableKVDriver.php +++ b/common/persistence/EnvironmentVariableKVDriver.php @@ -29,7 +29,6 @@ class EnvironmentVariableKVDriver implements common_persistence_KvDriver { - /** * @inheritDoc */ diff --git a/common/persistence/KeyValue/interface.Nx.php b/common/persistence/KeyValue/interface.Nx.php index 0c26ba572..1aaf663d9 100755 --- a/common/persistence/KeyValue/interface.Nx.php +++ b/common/persistence/KeyValue/interface.Nx.php @@ -1,4 +1,5 @@ exists($id) ? $this->persistence[$id] : false; } - + public function exists($id) { return array_key_exists($id, $this->persistence); diff --git a/common/persistence/class.KeyValuePersistence.php b/common/persistence/class.KeyValuePersistence.php index ac71e572c..67a3c04ed 100755 --- a/common/persistence/class.KeyValuePersistence.php +++ b/common/persistence/class.KeyValuePersistence.php @@ -1,4 +1,5 @@ >>>'; - const DEFAULT_START_MAP_DELIMITER = '<<<>>>'; - const DEFAULT_END_MAP_DELIMITER = '<<<>>>'; + public const DEFAULT_MAP_IDENTIFIER = '<<<>>>'; + public const DEFAULT_START_MAP_DELIMITER = '<<<>>>'; + public const DEFAULT_END_MAP_DELIMITER = '<<<>>>'; /** diff --git a/common/persistence/class.Manager.php b/common/persistence/class.Manager.php index 724520cf6..37bfaba21 100755 --- a/common/persistence/class.Manager.php +++ b/common/persistence/class.Manager.php @@ -23,19 +23,19 @@ use oat\oatbox\service\ServiceNotFoundException; use oat\generis\persistence\PersistenceManager; - /** - * A backward compatibility wrapper for our persistence factory - * - * @author Lionel Lecaque - * @license GPLv2 - * @package generis - * @deprecated use PersistenceManager - */ +/** +* A backward compatibility wrapper for our persistence factory +* +* @author Lionel Lecaque +* @license GPLv2 +* @package generis +* @deprecated use PersistenceManager +*/ class common_persistence_Manager extends PersistenceManager { /** @deprecated */ - const SERVICE_KEY = 'generis/persistences'; - + public const SERVICE_KEY = 'generis/persistences'; + /** * @return common_persistence_Manager * @deprecated diff --git a/common/persistence/class.NoStorageKvDriver.php b/common/persistence/class.NoStorageKvDriver.php index 9f5f32c0c..340202909 100644 --- a/common/persistence/class.NoStorageKvDriver.php +++ b/common/persistence/class.NoStorageKvDriver.php @@ -1,4 +1,5 @@ getDriver()->query($statement, $params, $types); } - + /** * Convenience access to quote. @@ -122,8 +122,8 @@ public function quote($parameter, $parameter_type = PDO::PARAM_STR) { return $this->getDriver()->quote($parameter, $parameter_type); } - - + + /** * Convenience access to lastInsertId. * diff --git a/common/persistence/interface.AdvKvDriver.php b/common/persistence/interface.AdvKvDriver.php index 8267f5da7..285523668 100644 --- a/common/persistence/interface.AdvKvDriver.php +++ b/common/persistence/interface.AdvKvDriver.php @@ -1,4 +1,5 @@ originals[$id] = clone $schema; $this->schemas[$id] = $schema; @@ -61,10 +61,10 @@ public function addSchema($id, Schema $schema) : void * @param string $id * @throws common_exception_InconsistentData */ - public function getOriginalSchema($id) : Schema + public function getOriginalSchema($id): Schema { if (!isset($this->originals[$id])) { - throw new common_exception_InconsistentData('Expected original schema '.$id.' not found'); + throw new common_exception_InconsistentData('Expected original schema ' . $id . ' not found'); } return $this->originals[$id]; } @@ -75,10 +75,10 @@ public function getOriginalSchema($id) : Schema * @throws common_exception_InconsistentData * @return Schema */ - public function getSchema($id) : Schema + public function getSchema($id): Schema { if (!isset($this->schemas[$id])) { - throw new common_exception_InconsistentData('Expected schema '.$id.' not found'); + throw new common_exception_InconsistentData('Expected schema ' . $id . ' not found'); } return $this->schemas[$id]; } diff --git a/common/persistence/sql/class.Filter.php b/common/persistence/sql/class.Filter.php index 627183b21..2b4a9d9cd 100644 --- a/common/persistence/sql/class.Filter.php +++ b/common/persistence/sql/class.Filter.php @@ -29,16 +29,16 @@ */ class common_persistence_sql_Filter { - const OP_EQ = '='; - const OP_NEQ = '!='; - const OP_LT = '<'; - const OP_LTE = '<='; - const OP_GT = '>'; - const OP_GTE = '>='; - const OP_LIKE = 'LIKE'; - const OP_NOT_LIKE = 'NOT LIKE'; - const OP_IN = 'IN'; - const OP_NOT_IN = 'NOT IN'; + public const OP_EQ = '='; + public const OP_NEQ = '!='; + public const OP_LT = '<'; + public const OP_LTE = '<='; + public const OP_GT = '>'; + public const OP_GTE = '>='; + public const OP_LIKE = 'LIKE'; + public const OP_NOT_LIKE = 'NOT LIKE'; + public const OP_IN = 'IN'; + public const OP_NOT_IN = 'NOT IN'; /** * @var array diff --git a/common/persistence/sql/class.Platform.php b/common/persistence/sql/class.Platform.php index 59e183726..aeb1068b1 100644 --- a/common/persistence/sql/class.Platform.php +++ b/common/persistence/sql/class.Platform.php @@ -29,23 +29,22 @@ class common_persistence_sql_Platform { - - const TRANSACTION_PLATFORM_DEFAULT = 0; - - const TRANSACTION_READ_UNCOMMITTED = Connection::TRANSACTION_READ_UNCOMMITTED; - - const TRANSACTION_READ_COMMITTED = Connection::TRANSACTION_READ_COMMITTED; - - const TRANSACTION_REPEATABLE_READ = Connection::TRANSACTION_REPEATABLE_READ; - - const TRANSACTION_SERIALIZABLE = Connection::TRANSACTION_SERIALIZABLE; - + public const TRANSACTION_PLATFORM_DEFAULT = 0; + + public const TRANSACTION_READ_UNCOMMITTED = Connection::TRANSACTION_READ_UNCOMMITTED; + + public const TRANSACTION_READ_COMMITTED = Connection::TRANSACTION_READ_COMMITTED; + + public const TRANSACTION_REPEATABLE_READ = Connection::TRANSACTION_REPEATABLE_READ; + + public const TRANSACTION_SERIALIZABLE = Connection::TRANSACTION_SERIALIZABLE; + protected $dbalPlatform; /** @var \Doctrine\DBAL\Connection */ protected $dbalConnection; - + /** * @author "Lionel Lecaque, " * @param $dbalConnection \Doctrine\DBAL\Connection @@ -90,7 +89,7 @@ public function getPhpTextValue($text) { return $text; } - + /** * * @author Lionel Lecaque, lionel@taotesting.com @@ -108,7 +107,7 @@ public function getNullString() { return "''"; } - + /** * * @param string $columnName @@ -183,7 +182,7 @@ public function migrateSchema(Schema $fromSchema, Schema $toSchema): int return $queryCount; } - + /** * Return driver name mysql, postgresql, oracle, mssql * @@ -276,7 +275,7 @@ public function beginTransaction() { $this->dbalConnection->beginTransaction(); } - + /** * Sets the transaction isolation level for the current connection. * @@ -301,10 +300,10 @@ public function setTransactionIsolation($level) if ($level === self::TRANSACTION_PLATFORM_DEFAULT) { $level = $this->dbalPlatform->getDefaultTransactionIsolationLevel(); } - + $this->dbalConnection->setTransactionIsolation($level); } - + /** * Gets the currently active transaction isolation level for the current sesson. * @@ -314,7 +313,7 @@ public function getTransactionIsolation() { return $this->dbalConnection->getTransactionIsolation(); } - + /** * Checks whether or not a transaction is currently active. * @@ -363,7 +362,7 @@ public function commit() } } } - + public function getTruncateTableSql($tableName) { return $this->dbalPlatform->getTruncateTableSql($tableName); diff --git a/common/persistence/sql/class.QueryIterator.php b/common/persistence/sql/class.QueryIterator.php index 601ea0087..cb650d8c5 100644 --- a/common/persistence/sql/class.QueryIterator.php +++ b/common/persistence/sql/class.QueryIterator.php @@ -1,4 +1,5 @@ " * @return Doctrine\DBAL\Schema\AbstractSchemaManager; */ abstract protected function getSchemaManager(); - + /** * Returns the column names of a given table * @@ -56,9 +56,9 @@ public function getColumnNames($table) { return $this->getSchemaManager()->listTableColumns($table); } - - - + + + /** * @author "Lionel Lecaque, " */ @@ -67,8 +67,8 @@ public function createSchema() $tables = $this->getSchemaManager()->listTables(); return new \Doctrine\DBAL\Schema\Schema($tables, [], $this->getSchemaManager()->createSchemaConfig()); } - - + + /** * @author "Lionel Lecaque, " * @param unknown $schema @@ -83,7 +83,7 @@ public function addColumnToTable($schema, $tblname, $column) $table->addColumn($column, "text", ["notnull" => false]); return $newSchema; } - + /** * Returns an array of string containting the names of the tables contained * the currently selected database in the storage engine. @@ -97,7 +97,7 @@ public function getTables() { return $this->getSchemaManager()->listTableNames(); } - + /** * @author "Lionel Lecaque, " * @param string $tableName @@ -106,7 +106,7 @@ public function getTableIndexes($tableName) { return $this->getSchemaManager()->listTableIndexes($tableName); } - + /** * Create an index on a given table and selected columns. This method throws * in case of error. @@ -142,7 +142,7 @@ public function getDbalSchemaManager() * @return string */ abstract public function getIndexAlreadyExistsErrorCode(); - + /** * * @author Lionel Lecaque, lionel@taotesting.com diff --git a/common/persistence/sql/class.SerializationException.php b/common/persistence/sql/class.SerializationException.php index 2384b9917..308e22d6f 100644 --- a/common/persistence/sql/class.SerializationException.php +++ b/common/persistence/sql/class.SerializationException.php @@ -1,4 +1,5 @@ " * @param AbstractSchemaManager $dbalSchemaManager @@ -38,8 +37,8 @@ public function __construct($dbalSchemaManager) { $this->dbalSchemaManager = $dbalSchemaManager; } - - + + /** * @author "Lionel Lecaque, " * @return AbstractSchemaManager @@ -48,8 +47,8 @@ protected function getSchemaManager() { return $this->dbalSchemaManager; } - - + + /** * Short description of method getIndexAlreadyExistsErrorCode * @@ -61,7 +60,7 @@ public function getIndexAlreadyExistsErrorCode() { return '42P07'; } - + /** * Short description of method getIndexAlreadyExistsErrorCode * diff --git a/common/persistence/sql/interface.Driver.php b/common/persistence/sql/interface.Driver.php index c320a6b1d..59f0dffcd 100644 --- a/common/persistence/sql/interface.Driver.php +++ b/common/persistence/sql/interface.Driver.php @@ -1,4 +1,5 @@ getServiceLocator()->get(UserLanguageServiceInterface::SERVICE_ID)->getDefaultLanguage(); } - + /** * (non-PHPdoc) * @see common_session_Session::getInterfaceLanguage() @@ -80,7 +80,7 @@ public function getInterfaceLanguage() : $this->getServiceLocator()->get(UserLanguageServiceInterface::SERVICE_ID)->getDefaultLanguage(); ; } - + /** * (non-PHPdoc) * @see common_session_Session::getTimeZone() @@ -89,7 +89,7 @@ public function getTimeZone() { return TIME_ZONE; } - + /** * (non-PHPdoc) * @see common_session_Session::getUserPropertyValues() @@ -98,7 +98,7 @@ public function getUserPropertyValues($property) { return []; } - + /** * (non-PHPdoc) * @see common_session_Session::refresh() diff --git a/common/session/class.BasicSession.php b/common/session/class.BasicSession.php index f1df3a6eb..6e903fafa 100644 --- a/common/session/class.BasicSession.php +++ b/common/session/class.BasicSession.php @@ -62,12 +62,12 @@ public function __construct(User $user, array $contexts = []) $this->user = $user; $this->contexts = $contexts; } - + public function getUser() { return $this->user; } - + /** * {@inheritDoc} * @see common_session_Session::getUserUri() @@ -76,7 +76,7 @@ public function getUserUri() { return $this->user->getIdentifier(); } - + /** * @param string $property * @return mixed @@ -85,7 +85,7 @@ public function getUserPropertyValues($property) { return $this->user->getPropertyValues($property); } - + /** * (non-PHPdoc) * @see common_session_Session::getUserLabel() @@ -110,7 +110,7 @@ public function getUserLabel() } return $label; } - + /** * {@inheritDoc} * @see common_session_Session::getUserRoles() @@ -157,7 +157,7 @@ public function getInterfaceLanguage() return $userLanguageService->getInterfaceLanguage($this->getUser()); } - + /** * (non-PHPdoc) * @see common_session_Session::getTimeZone() @@ -168,7 +168,7 @@ public function getTimeZone() $tz = empty($tzs) ? '' : (string)current($tzs); return empty($tz) ? TIME_ZONE : $tz; } - + public function refresh() { if ($this->user instanceof Refreshable) { @@ -193,9 +193,10 @@ public function getContexts(string $class = null): array { $contexts = $this->contexts; if ($class != null) { - $contexts = array_filter($contexts, function($element) use ($class) {return $element instanceof $class;}); + $contexts = array_filter($contexts, function ($element) use ($class) { + return $element instanceof $class; + }); } return $contexts; } - } diff --git a/common/session/class.DefaultSession.php b/common/session/class.DefaultSession.php index 296f4326d..3e7c1ba77 100755 --- a/common/session/class.DefaultSession.php +++ b/common/session/class.DefaultSession.php @@ -29,5 +29,4 @@ */ class common_session_DefaultSession extends common_session_BasicSession implements common_session_StatefulSession { - } diff --git a/common/session/class.RestSession.php b/common/session/class.RestSession.php index 7387c6fb9..e047a30c0 100644 --- a/common/session/class.RestSession.php +++ b/common/session/class.RestSession.php @@ -29,5 +29,4 @@ */ class common_session_RestSession extends common_session_BasicSession implements common_session_StatelessSession { - } diff --git a/common/session/class.RestrictedSession.php b/common/session/class.RestrictedSession.php index c6976b795..ffc63b9cf 100755 --- a/common/session/class.RestrictedSession.php +++ b/common/session/class.RestrictedSession.php @@ -1,4 +1,5 @@ internalSession = $session; $this->filter = $filter; } - + /** * (non-PHPdoc) * @see common_session_Session::getUser() @@ -63,7 +64,7 @@ public function getUser() { return $this->internalSession->getUser(); } - + /** * (non-PHPdoc) * @see common_session_AbstractSession::getUserUri() @@ -72,7 +73,7 @@ public function getUserUri() { return $this->internalSession->getUserUri(); } - + /** * (non-PHPdoc) * @see common_session_Session::getUserLabel() @@ -81,7 +82,7 @@ public function getUserLabel() { return $this->internalSession->getUserLabel(); } - + /** * (non-PHPdoc) * @see common_session_AbstractSession::getUserRoles() @@ -97,7 +98,7 @@ public function getUserRoles() } return $returnValue; } - + /** * (non-PHPdoc) * @see common_session_Session::getDataLanguage() @@ -106,7 +107,7 @@ public function getDataLanguage() { return $this->internalSession->getDataLanguage(); } - + /** * (non-PHPdoc) * @see common_session_Session::getInterfaceLanguage() @@ -115,7 +116,7 @@ public function getInterfaceLanguage() { return $this->internalSession->getInterfaceLanguage(); } - + /** * (non-PHPdoc) * @see common_session_Session::getUserPropertyValues() @@ -124,7 +125,7 @@ public function getUserPropertyValues($property) { return $this->internalSession->getUserPropertyValues($property); } - + /** * (non-PHPdoc) * @see common_session_Session::getTimeZone() @@ -133,8 +134,8 @@ public function getTimeZone() { return $this->internalSession->getTimeZone(); } - - + + /** * (non-PHPdoc) * @see common_session_Session::refresh() @@ -143,7 +144,7 @@ public function refresh() { $this->internalSession->refresh(); } - + /** * Revert back to the original Session */ diff --git a/common/session/class.SessionManager.php b/common/session/class.SessionManager.php index a506e07d0..69b5f0f42 100755 --- a/common/session/class.SessionManager.php +++ b/common/session/class.SessionManager.php @@ -32,8 +32,7 @@ */ abstract class common_session_SessionManager { - - const PHPSESSION_SESSION_KEY = 'common_session_Session'; + public const PHPSESSION_SESSION_KEY = 'common_session_Session'; private static $session = null; @@ -61,7 +60,7 @@ public static function getSession() } return self::$session; } - + /** * Starts a new session and stores it in the session if stateful * @@ -83,13 +82,13 @@ public static function startSession(common_session_Session $session) // prevent session fixation. session_regenerate_id(); } - + PHPSession::singleton()->setAttribute(self::PHPSESSION_SESSION_KEY, $session); } } return true; } - + /** * Ends the session by replacing it with an anonymous session * @@ -102,10 +101,10 @@ public static function endSession() if (session_id() != '') { session_destroy(); } - + return self::startSession(new common_session_AnonymousSession()); } - + /** * Is the current session anonymous or associated to a user? * diff --git a/common/session/interface.Session.php b/common/session/interface.Session.php index b88bae86b..a5ed91a12 100755 --- a/common/session/interface.Session.php +++ b/common/session/interface.Session.php @@ -1,4 +1,5 @@ user = new common_test_TestUser([ @@ -57,12 +57,12 @@ public function __construct() GenerisRdf::PROPERTY_USER_UILG => [DEFAULT_LANG] ]); } - + public function getUser() { return $this->user; } - + /** * {@inheritDoc} * @see common_session_Session::getUserUri() @@ -71,7 +71,7 @@ public function getUserUri() { return $this->getUser()->getIdentifier(); } - + /** * {@inheritDoc} * @see common_session_Session::getUserLabel() @@ -80,7 +80,7 @@ public function getUserLabel() { return 'Virtual Test User'; } - + /** * {@inheritDoc} * @see common_session_Session::getUserRoles() @@ -89,7 +89,7 @@ public function getUserRoles() { return []; } - + /** * (non-PHPdoc) * @see common_session_Session::getUserPropertyValues() @@ -98,8 +98,8 @@ public function getUserPropertyValues($property) { return []; } - - + + /** * changes the current data language * @@ -109,7 +109,7 @@ public function setDataLanguage($languageCode) { $this->getUser()->setPropertyValues(GenerisRdf::PROPERTY_USER_DEFLG, [$languageCode]); } - + /** * (non-PHPdoc) * @see common_session_Session::getDataLanguage() @@ -119,7 +119,7 @@ public function getDataLanguage() $values = $this->getUser()->getPropertyValues(GenerisRdf::PROPERTY_USER_DEFLG); return $values[0]; } - + /** * Changes the current interface language * @@ -129,7 +129,7 @@ public function setInterfaceLanguage($languageCode) { return $this->getUser()->setPropertyValues(GenerisRdf::PROPERTY_USER_UILG, [$languageCode]); } - + /** * (non-PHPdoc) * @see common_session_Session::getInterfaceLanguage() @@ -139,7 +139,7 @@ public function getInterfaceLanguage() $values = $this->getUser()->getPropertyValues(GenerisRdf::PROPERTY_USER_UILG); return $values[0]; } - + /** * Changes the timezone of the test session * @@ -149,7 +149,7 @@ public function setTimeZone($timezone) { $this->timezone = $timezone; } - + /** * (non-PHPdoc) * @see common_session_Session::getTimeZone() @@ -158,7 +158,7 @@ public function getTimeZone() { return $this->timezone; } - + /** * (non-PHPdoc) * @see common_session_Session::refresh() diff --git a/common/uri/class.AbstractUriProvider.php b/common/uri/class.AbstractUriProvider.php index 3e1e8474c..fd9df0456 100644 --- a/common/uri/class.AbstractUriProvider.php +++ b/common/uri/class.AbstractUriProvider.php @@ -1,4 +1,5 @@ driver; - + return (string) $returnValue; } @@ -78,7 +79,7 @@ public function getDriver() */ public function setDriver($driver) { - + $this->driver = strtolower($driver); } @@ -92,7 +93,7 @@ public function setDriver($driver) */ public function __construct($driver) { - + $this->setDriver($driver); } } /* end of abstract class common_uri_AbstractUriProvider */ diff --git a/common/uri/class.MicrotimeUriProvider.php b/common/uri/class.MicrotimeUriProvider.php index 5cd2388e6..77eeb414c 100644 --- a/common/uri/class.MicrotimeUriProvider.php +++ b/common/uri/class.MicrotimeUriProvider.php @@ -1,4 +1,5 @@ getLocalNamespace()->getUri(); $dbWrapper = core_kernel_classes_DbWrapper::singleton(); $uriExist = false; @@ -56,19 +57,19 @@ public function provide() list($usec, $sec) = explode(" ", microtime()); $uri = $modelUri . 'i' . (str_replace(".", "", $sec . "" . $usec)); $sqlResult = $dbWrapper->query("SELECT COUNT(subject) AS num FROM statements WHERE subject = '" . $uri . "'"); - + if ($row = $sqlResult->fetch()) { $found = (int)$row['num']; if ($found > 0) { $uriExist = true; } - + $sqlResult->closeCursor(); } } while ($uriExist); - + $returnValue = $uri; - + return (string) $returnValue; } diff --git a/common/uri/interface.UriProvider.php b/common/uri/interface.UriProvider.php index f8586a531..273c76ac1 100644 --- a/common/uri/interface.UriProvider.php +++ b/common/uri/interface.UriProvider.php @@ -35,5 +35,4 @@ */ interface common_uri_UriProvider extends UriProvider { - } diff --git a/common/user/auth/class.AuthFailedException.php b/common/user/auth/class.AuthFailedException.php index 580e1dfee..bcc3d2f4e 100755 --- a/common/user/auth/class.AuthFailedException.php +++ b/common/user/auth/class.AuthFailedException.php @@ -1,4 +1,5 @@ [ 'oat\\generis\\model\\data\\event\\ResourceCreated' => [ diff --git a/config/default/permissions.conf.php b/config/default/permissions.conf.php index 3c628255a..d903cc2d1 100644 --- a/config/default/permissions.conf.php +++ b/config/default/permissions.conf.php @@ -1,2 +1,3 @@ ontology)) { return ($this instanceof ServiceLocatorAwareInterface && !is_null($this->getServiceLocator())) @@ -55,34 +55,34 @@ function getModel() * Sets the model to use * @param Ontology $model */ - function setModel(Ontology $model) + public function setModel(Ontology $model) { $this->ontology = $model; } - + /** * @param string $uri * @return \core_kernel_classes_Resource */ - function getResource($uri) + public function getResource($uri) { return $this->getModel()->getResource($uri); } - + /** * @param string $uri * @return \core_kernel_classes_Class */ - function getClass($uri) + public function getClass($uri) { return $this->getModel()->getClass($uri); } - + /** * @param string $uri * @return \core_kernel_classes_Property */ - function getProperty($uri) + public function getProperty($uri) { return $this->getModel()->getProperty($uri); } diff --git a/core/OntologyRdf.php b/core/OntologyRdf.php index c3ed139d4..09b31388f 100644 --- a/core/OntologyRdf.php +++ b/core/OntologyRdf.php @@ -23,11 +23,11 @@ interface OntologyRdf { - const RDF_TYPE = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type'; - const RDF_PROPERTY = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#Property'; - const RDF_VALUE = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#value'; - const RDF_STATEMENT = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#Statement'; - const RDF_FIRST = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#first'; - const RDF_REST = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#rest'; - const RDF_LIST = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#List'; + public const RDF_TYPE = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type'; + public const RDF_PROPERTY = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#Property'; + public const RDF_VALUE = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#value'; + public const RDF_STATEMENT = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#Statement'; + public const RDF_FIRST = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#first'; + public const RDF_REST = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#rest'; + public const RDF_LIST = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#List'; } diff --git a/core/OntologyRdfs.php b/core/OntologyRdfs.php index 35935c62e..cab392076 100644 --- a/core/OntologyRdfs.php +++ b/core/OntologyRdfs.php @@ -23,15 +23,15 @@ interface OntologyRdfs { - const RDFS_COMMENT = 'http://www.w3.org/2000/01/rdf-schema#comment'; - const RDFS_LABEL = 'http://www.w3.org/2000/01/rdf-schema#label'; - const RDFS_LITERAL = 'http://www.w3.org/2000/01/rdf-schema#Literal'; - const RDFS_SEEALSO = 'http://www.w3.org/2000/01/rdf-schema#seeAlso'; - const RDFS_DATATYPE = 'http://www.w3.org/2000/01/rdf-schema#Datatype'; - const RDFS_CLASS = 'http://www.w3.org/2000/01/rdf-schema#Class'; - const RDFS_SUBCLASSOF = 'http://www.w3.org/2000/01/rdf-schema#subClassOf'; - const RDFS_DOMAIN = 'http://www.w3.org/2000/01/rdf-schema#domain'; - const RDFS_RESOURCE = 'http://www.w3.org/2000/01/rdf-schema#Resource'; - const RDFS_RANGE = 'http://www.w3.org/2000/01/rdf-schema#range'; - const RDFS_SUBPROPERTYOF = 'http://www.w3.org/2000/01/rdf-schema#subPropertyOf'; + public const RDFS_COMMENT = 'http://www.w3.org/2000/01/rdf-schema#comment'; + public const RDFS_LABEL = 'http://www.w3.org/2000/01/rdf-schema#label'; + public const RDFS_LITERAL = 'http://www.w3.org/2000/01/rdf-schema#Literal'; + public const RDFS_SEEALSO = 'http://www.w3.org/2000/01/rdf-schema#seeAlso'; + public const RDFS_DATATYPE = 'http://www.w3.org/2000/01/rdf-schema#Datatype'; + public const RDFS_CLASS = 'http://www.w3.org/2000/01/rdf-schema#Class'; + public const RDFS_SUBCLASSOF = 'http://www.w3.org/2000/01/rdf-schema#subClassOf'; + public const RDFS_DOMAIN = 'http://www.w3.org/2000/01/rdf-schema#domain'; + public const RDFS_RESOURCE = 'http://www.w3.org/2000/01/rdf-schema#Resource'; + public const RDFS_RANGE = 'http://www.w3.org/2000/01/rdf-schema#range'; + public const RDFS_SUBPROPERTYOF = 'http://www.w3.org/2000/01/rdf-schema#subPropertyOf'; } diff --git a/core/RulesRdf.php b/core/RulesRdf.php index 2e83387da..3e7127cd5 100644 --- a/core/RulesRdf.php +++ b/core/RulesRdf.php @@ -23,52 +23,52 @@ interface RulesRdf { - const CLASS_URI = 'http://www.tao.lu/middleware/Rules.rdf'; - const PROPERTY_OPERATION_FIRST_OP = 'http://www.tao.lu/middleware/Rules.rdf#FirstOperand'; - const PROPERTY_OPERATION_SECOND_OP = 'http://www.tao.lu/middleware/Rules.rdf#SecondOperand'; - const PROPERTY_OPERATION_OPERATOR = 'http://www.tao.lu/middleware/Rules.rdf#HasOperator'; - const PROPERTY_RULE_IF = 'http://www.tao.lu/middleware/Rules.rdf#If'; - const CLASS_URI_TERM_X_PREDICATE_OBJECT = 'http://www.tao.lu/middleware/Rules.rdf#XPredicateObject'; - const PROPERTY_TERM_XPO_OBJECT = 'http://www.tao.lu/middleware/Rules.rdf#Object'; - const PROPERTY_TERM_XPO_PREDICATE = 'http://www.tao.lu/middleware/Rules.rdf#Predicate'; - const INSTANCE_OPERATOR_ADD = 'http://www.tao.lu/middleware/Rules.rdf#Plus'; - const INSTANCE_OPERATOR_MINUS = 'http://www.tao.lu/middleware/Rules.rdf#Minus'; - const INSTANCE_OPERATOR_DIVISION = 'http://www.tao.lu/middleware/Rules.rdf#Division'; - const INSTANCE_OPERATOR_MULTIPLY = 'http://www.tao.lu/middleware/Rules.rdf#Multiply'; - const INSTANCE_OPERATOR_CONCAT = 'http://www.tao.lu/middleware/Rules.rdf#Concat'; - const INSTANCE_OPERATOR_UNION = 'http://www.tao.lu/middleware/Rules.rdf#Union'; - const INSTANCE_OPERATOR_INTERSECT = 'http://www.tao.lu/middleware/Rules.rdf#Intersect'; - const CLASS_URI_CONSTRUCTED_SET = 'http://www.tao.lu/middleware/Rules.rdf#ConstrcuctedSet'; - const PROPERTY_SET_OPERATOR = 'http://www.tao.lu/middleware/Rules.rdf#HasSetOperator'; - const PROPERTY_SUBSET = 'http://www.tao.lu/middleware/Rules.rdf#SubSets'; - const CLASS_URI_ASSIGNMENT = 'http://www.tao.lu/middleware/Rules.rdf#Assignment'; - const PROPERTY_ASSIGNMENT_VARIABLE = 'http://www.tao.lu/middleware/Rules.rdf#Variable'; - const PROPERTY_ASSIGNMENT_VALUE = 'http://www.tao.lu/middleware/Rules.rdf#Value'; - const CLASS_URI_EXPRESSION = 'http://www.tao.lu/middleware/Rules.rdf#Expression'; - const PROPERTY_FIRST_EXPRESSION = 'http://www.tao.lu/middleware/Rules.rdf#FirstExpression'; - const PROPERTY_SECOND_EXPRESSION = 'http://www.tao.lu/middleware/Rules.rdf#SecondExpression'; - const PROPERTY_HASLOGICALOPERATOR = 'http://www.tao.lu/middleware/Rules.rdf#HasLogicalOperator'; - const INSTANCE_OR_OPERATOR = 'http://www.tao.lu/middleware/Rules.rdf#Or'; - const INSTANCE_AND_OPERATOR = 'http://www.tao.lu/middleware/Rules.rdf#And'; - const INSTANCE_EXPRESSION_TRUE = 'http://www.tao.lu/middleware/Rules.rdf#TrueExpression'; - const INSTANCE_EXPRESSION_FALSE = 'http://www.tao.lu/middleware/Rules.rdf#FalseExpression'; - const PROPERTY_TERMINAL_EXPRESSION = 'http://www.tao.lu/middleware/Rules.rdf#TerminalExpression'; - const CLASS_DYNAMICTEXT = 'http://www.tao.lu/middleware/Rules.rdf#DynamicText'; - const CLASS_RULE = 'http://www.tao.lu/middleware/Rules.rdf#Rule'; - const CLASS_TERM = 'http://www.tao.lu/middleware/Rules.rdf#Term'; - const CLASS_TERM_CONST = 'http://www.tao.lu/middleware/Rules.rdf#Const'; - const CLASS_OPERATION = 'http://www.tao.lu/middleware/Rules.rdf#Operation'; - const CLASS_TERM_SUJET_PREDICATE_X = 'http://www.tao.lu/middleware/Rules.rdf#SubjectPredicateX'; - const PROPERTY_TERM_SPX_SUBJET = 'http://www.tao.lu/middleware/Rules.rdf#Subject'; - const PROPERTY_TERM_SPX_PREDICATE = 'http://www.tao.lu/middleware/Rules.rdf#Predicate'; - const PROPERTY_TERM_VALUE = 'http://www.tao.lu/middleware/Rules.rdf#TermValue'; - const INSTANCE_EXISTS_OPERATOR_URI = 'http://www.tao.lu/middleware/Rules.rdf#Exists'; - const INSTANCE_EQUALS_OPERATOR_URI = 'http://www.tao.lu/middleware/Rules.rdf#Equal'; - const INSTANCE_DIFFERENT_OPERATOR_URI = 'http://www.tao.lu/middleware/Rules.rdf#NotEqual'; - const INSTANCE_SUP_EQ_OPERATOR_URI = 'http://www.tao.lu/middleware/Rules.rdf#GreaterThanOrEqual'; - const INSTANCE_INF_EQ_OPERATOR_URI = 'http://www.tao.lu/middleware/Rules.rdf#LessThanOrEqual'; - const INSTANCE_SUP_OPERATOR_URI = 'http://www.tao.lu/middleware/Rules.rdf#GreaterThan'; - const INSTANCE_INF_OPERATOR_URI = 'http://www.tao.lu/middleware/Rules.rdf#LessThan'; - const INSTANCE_EMPTY_TERM_URI = 'http://www.tao.lu/middleware/Rules.rdf#Empty'; - const INSTANCE_TERM_IS_NULL = 'http://www.tao.lu/middleware/Rules.rdf#IsNull'; + public const CLASS_URI = 'http://www.tao.lu/middleware/Rules.rdf'; + public const PROPERTY_OPERATION_FIRST_OP = 'http://www.tao.lu/middleware/Rules.rdf#FirstOperand'; + public const PROPERTY_OPERATION_SECOND_OP = 'http://www.tao.lu/middleware/Rules.rdf#SecondOperand'; + public const PROPERTY_OPERATION_OPERATOR = 'http://www.tao.lu/middleware/Rules.rdf#HasOperator'; + public const PROPERTY_RULE_IF = 'http://www.tao.lu/middleware/Rules.rdf#If'; + public const CLASS_URI_TERM_X_PREDICATE_OBJECT = 'http://www.tao.lu/middleware/Rules.rdf#XPredicateObject'; + public const PROPERTY_TERM_XPO_OBJECT = 'http://www.tao.lu/middleware/Rules.rdf#Object'; + public const PROPERTY_TERM_XPO_PREDICATE = 'http://www.tao.lu/middleware/Rules.rdf#Predicate'; + public const INSTANCE_OPERATOR_ADD = 'http://www.tao.lu/middleware/Rules.rdf#Plus'; + public const INSTANCE_OPERATOR_MINUS = 'http://www.tao.lu/middleware/Rules.rdf#Minus'; + public const INSTANCE_OPERATOR_DIVISION = 'http://www.tao.lu/middleware/Rules.rdf#Division'; + public const INSTANCE_OPERATOR_MULTIPLY = 'http://www.tao.lu/middleware/Rules.rdf#Multiply'; + public const INSTANCE_OPERATOR_CONCAT = 'http://www.tao.lu/middleware/Rules.rdf#Concat'; + public const INSTANCE_OPERATOR_UNION = 'http://www.tao.lu/middleware/Rules.rdf#Union'; + public const INSTANCE_OPERATOR_INTERSECT = 'http://www.tao.lu/middleware/Rules.rdf#Intersect'; + public const CLASS_URI_CONSTRUCTED_SET = 'http://www.tao.lu/middleware/Rules.rdf#ConstrcuctedSet'; + public const PROPERTY_SET_OPERATOR = 'http://www.tao.lu/middleware/Rules.rdf#HasSetOperator'; + public const PROPERTY_SUBSET = 'http://www.tao.lu/middleware/Rules.rdf#SubSets'; + public const CLASS_URI_ASSIGNMENT = 'http://www.tao.lu/middleware/Rules.rdf#Assignment'; + public const PROPERTY_ASSIGNMENT_VARIABLE = 'http://www.tao.lu/middleware/Rules.rdf#Variable'; + public const PROPERTY_ASSIGNMENT_VALUE = 'http://www.tao.lu/middleware/Rules.rdf#Value'; + public const CLASS_URI_EXPRESSION = 'http://www.tao.lu/middleware/Rules.rdf#Expression'; + public const PROPERTY_FIRST_EXPRESSION = 'http://www.tao.lu/middleware/Rules.rdf#FirstExpression'; + public const PROPERTY_SECOND_EXPRESSION = 'http://www.tao.lu/middleware/Rules.rdf#SecondExpression'; + public const PROPERTY_HASLOGICALOPERATOR = 'http://www.tao.lu/middleware/Rules.rdf#HasLogicalOperator'; + public const INSTANCE_OR_OPERATOR = 'http://www.tao.lu/middleware/Rules.rdf#Or'; + public const INSTANCE_AND_OPERATOR = 'http://www.tao.lu/middleware/Rules.rdf#And'; + public const INSTANCE_EXPRESSION_TRUE = 'http://www.tao.lu/middleware/Rules.rdf#TrueExpression'; + public const INSTANCE_EXPRESSION_FALSE = 'http://www.tao.lu/middleware/Rules.rdf#FalseExpression'; + public const PROPERTY_TERMINAL_EXPRESSION = 'http://www.tao.lu/middleware/Rules.rdf#TerminalExpression'; + public const CLASS_DYNAMICTEXT = 'http://www.tao.lu/middleware/Rules.rdf#DynamicText'; + public const CLASS_RULE = 'http://www.tao.lu/middleware/Rules.rdf#Rule'; + public const CLASS_TERM = 'http://www.tao.lu/middleware/Rules.rdf#Term'; + public const CLASS_TERM_CONST = 'http://www.tao.lu/middleware/Rules.rdf#Const'; + public const CLASS_OPERATION = 'http://www.tao.lu/middleware/Rules.rdf#Operation'; + public const CLASS_TERM_SUJET_PREDICATE_X = 'http://www.tao.lu/middleware/Rules.rdf#SubjectPredicateX'; + public const PROPERTY_TERM_SPX_SUBJET = 'http://www.tao.lu/middleware/Rules.rdf#Subject'; + public const PROPERTY_TERM_SPX_PREDICATE = 'http://www.tao.lu/middleware/Rules.rdf#Predicate'; + public const PROPERTY_TERM_VALUE = 'http://www.tao.lu/middleware/Rules.rdf#TermValue'; + public const INSTANCE_EXISTS_OPERATOR_URI = 'http://www.tao.lu/middleware/Rules.rdf#Exists'; + public const INSTANCE_EQUALS_OPERATOR_URI = 'http://www.tao.lu/middleware/Rules.rdf#Equal'; + public const INSTANCE_DIFFERENT_OPERATOR_URI = 'http://www.tao.lu/middleware/Rules.rdf#NotEqual'; + public const INSTANCE_SUP_EQ_OPERATOR_URI = 'http://www.tao.lu/middleware/Rules.rdf#GreaterThanOrEqual'; + public const INSTANCE_INF_EQ_OPERATOR_URI = 'http://www.tao.lu/middleware/Rules.rdf#LessThanOrEqual'; + public const INSTANCE_SUP_OPERATOR_URI = 'http://www.tao.lu/middleware/Rules.rdf#GreaterThan'; + public const INSTANCE_INF_OPERATOR_URI = 'http://www.tao.lu/middleware/Rules.rdf#LessThan'; + public const INSTANCE_EMPTY_TERM_URI = 'http://www.tao.lu/middleware/Rules.rdf#Empty'; + public const INSTANCE_TERM_IS_NULL = 'http://www.tao.lu/middleware/Rules.rdf#IsNull'; } diff --git a/core/data/Model.php b/core/data/Model.php index 3f5618c81..570d79b0e 100755 --- a/core/data/Model.php +++ b/core/data/Model.php @@ -29,21 +29,20 @@ */ interface Model { - /** * Creates a model from a configuration array provided by getConfig() * * @param array $config */ - function __construct($options = []); - + public function __construct($options = []); + /** * Returns a configuration array that can be used to instanciate the model * should only contain scalars as values * * @return array */ - function getOptions(); + public function getOptions(); /** * Experimental interface to access the data of the model @@ -51,15 +50,15 @@ function getOptions(); * * @return RdfInterface */ - function getRdfInterface(); - + public function getRdfInterface(); + /** * Expected interface to access the data of the model * * @return RdfsInterface */ - function getRdfsInterface(); - + public function getRdfsInterface(); + /** * Get search interface for model */ diff --git a/core/data/ModelManager.php b/core/data/ModelManager.php index d8a3295c4..d991a9b43 100755 --- a/core/data/ModelManager.php +++ b/core/data/ModelManager.php @@ -32,8 +32,8 @@ */ class ModelManager { - const CONFIG_KEY = 'ontology'; - + public const CONFIG_KEY = 'ontology'; + /** * @return Model */ @@ -41,7 +41,7 @@ public static function getModel() { return ServiceManager::getServiceManager()->get(Ontology::SERVICE_ID); } - + /** * @param Ontology $model */ @@ -49,7 +49,7 @@ public static function setModel(Model $model) { return ServiceManager::getServiceManager()->register(Ontology::SERVICE_ID, $model); } - + protected static function model2array(Model $model) { $className = get_class($model); @@ -58,7 +58,7 @@ protected static function model2array(Model $model) 'config' => $model->getOptions() ]; } - + protected static function array2model($array) { if (!isset($array['class']) || !isset($array['config']) || !is_array($array['config'])) { diff --git a/core/data/Ontology.php b/core/data/Ontology.php index 968d58cb2..b85451839 100755 --- a/core/data/Ontology.php +++ b/core/data/Ontology.php @@ -28,23 +28,23 @@ */ interface Ontology extends Model { - const SERVICE_ID = 'generis/ontology'; + public const SERVICE_ID = 'generis/ontology'; /** * @param string $uri * @return \core_kernel_classes_Resource */ - function getResource($uri); + public function getResource($uri); /** * @param string $uri * @return \core_kernel_classes_Class */ - function getClass($uri); + public function getClass($uri); /** * @param string $uri * @return \core_kernel_classes_Property */ - function getProperty($uri); + public function getProperty($uri); } diff --git a/core/data/RdfInterface.php b/core/data/RdfInterface.php index a06f327ab..7647e41ec 100755 --- a/core/data/RdfInterface.php +++ b/core/data/RdfInterface.php @@ -43,7 +43,7 @@ interface RdfInterface extends \IteratorAggregate * @return array */ public function get($subject, $predicate); - + /** * Adds a triple to the model * @@ -64,7 +64,7 @@ public function addTripleCollection(Traversable $triples); * @param \core_kernel_classes_Triple $triple */ public function remove(\core_kernel_classes_Triple $triple); - + /** * Returns an array of the triples with the given predicate, object * diff --git a/core/data/RdfsInterface.php b/core/data/RdfsInterface.php index ccbaa97c0..cfd89fc4f 100755 --- a/core/data/RdfsInterface.php +++ b/core/data/RdfsInterface.php @@ -31,28 +31,27 @@ */ interface RdfsInterface { - /** * Returns the implementation of the class interface * * @return \core_kernel_persistence_ClassInterface */ public function getClassImplementation(); - + /** * Returns the implementation of the resource interface * * @return \core_kernel_persistence_ResourceInterface */ public function getResourceImplementation(); - + /** * Returns the implementation of the property interface * * @return \core_kernel_persistence_PropertyInterface */ public function getPropertyImplementation(); - + // planned interface // public function getSearchImplementation(); } diff --git a/core/data/event/ResourceCreated.php b/core/data/event/ResourceCreated.php index faba1ae0b..09cb19dbb 100755 --- a/core/data/event/ResourceCreated.php +++ b/core/data/event/ResourceCreated.php @@ -32,18 +32,18 @@ class ResourceCreated implements Event { private $resource; - - function __construct(\core_kernel_classes_Resource $resource) + + public function __construct(\core_kernel_classes_Resource $resource) { $this->resource = $resource; } - - function getResource() + + public function getResource() { return $this->resource; } - function getName() + public function getName() { return __CLASS__; } diff --git a/core/data/event/ResourceDeleted.php b/core/data/event/ResourceDeleted.php index 724626043..bcf2f393e 100755 --- a/core/data/event/ResourceDeleted.php +++ b/core/data/event/ResourceDeleted.php @@ -41,12 +41,12 @@ class ResourceDeleted implements Event, JsonSerializable /** * @param string $uri */ - function __construct($uri) + public function __construct($uri) { $this->uri = $uri; } - function getId(): string + public function getId(): string { return $this->uri; } @@ -54,7 +54,7 @@ function getId(): string /** * {@inheritdoc} */ - function getName() + public function getName() { return __CLASS__; } diff --git a/core/data/event/ResourceUpdated.php b/core/data/event/ResourceUpdated.php index bcc5bd89c..eaaded2d6 100755 --- a/core/data/event/ResourceUpdated.php +++ b/core/data/event/ResourceUpdated.php @@ -31,18 +31,18 @@ class ResourceUpdated implements Event { private $resource; - - function __construct(\core_kernel_classes_Resource $resource) + + public function __construct(\core_kernel_classes_Resource $resource) { $this->resource = $resource; } - - function getResource() + + public function getResource() { return $this->resource; } - function getName() + public function getName() { return __CLASS__; } diff --git a/core/data/import/RdfImporter.php b/core/data/import/RdfImporter.php index d5d9fd2ba..24366dd47 100644 --- a/core/data/import/RdfImporter.php +++ b/core/data/import/RdfImporter.php @@ -41,13 +41,15 @@ class RdfImporter extends ConfigurableService { use OntologyAwareTrait; + /** * Imports an RDF file into the ontology as readonly model * @param string $filePath * @throws common_Exception * @return boolean */ - public function importFile(string $filePath) { + public function importFile(string $filePath) + { if (!file_exists($filePath) || !is_readable($filePath)) { throw new common_Exception("Unable to load ontology : $filePath"); } @@ -60,7 +62,8 @@ public function importFile(string $filePath) { * @param iterable $triples * @return void */ - public function importTriples(iterable $triples) { + public function importTriples(iterable $triples) + { $rdf = $this->getServiceLocator()->get(Ontology::SERVICE_ID)->getRdfInterface(); $rdf->addTripleCollection($triples); foreach ($triples as $triple) { diff --git a/core/data/permission/PermissionHelper.php b/core/data/permission/PermissionHelper.php index 17823f640..b38b121e2 100644 --- a/core/data/permission/PermissionHelper.php +++ b/core/data/permission/PermissionHelper.php @@ -38,9 +38,11 @@ public function filterByPermission(array $resourceIds, string $right): array if (!in_array($right, $provider->getSupportedRights())) { return $resourceIds; } - $permissions = $provider->getPermissions($this->getCurrentUser(),$resourceIds); + $permissions = $provider->getPermissions($this->getCurrentUser(), $resourceIds); - return array_filter($resourceIds, function($id) use ($right, $permissions){ return isset($permissions[$id]) && in_array($right, $permissions[$id]); }); + return array_filter($resourceIds, function ($id) use ($right, $permissions) { + return isset($permissions[$id]) && in_array($right, $permissions[$id]); + }); } private function getCurrentUser(): User diff --git a/core/data/permission/PermissionInterface.php b/core/data/permission/PermissionInterface.php index 819e6bfac..57f138c3b 100644 --- a/core/data/permission/PermissionInterface.php +++ b/core/data/permission/PermissionInterface.php @@ -34,7 +34,7 @@ */ interface PermissionInterface { - const SERVICE_ID = 'generis/permissions'; + public const SERVICE_ID = 'generis/permissions'; /** * All unsupported rigths will be mapped to this right @@ -44,7 +44,7 @@ interface PermissionInterface public const RIGHT_UNSUPPORTED = 'unsupported'; public const RIGHT_READ = 'READ'; public const RIGHT_WRITE = 'WRITE'; - + /** * Return the permissions a specified user has on the resources * specified by their ids @@ -57,12 +57,12 @@ interface PermissionInterface * @return array */ public function getPermissions(User $user, array $resourceIds); - + /** * Hook to set initial permissions */ public function onResourceCreated(\core_kernel_classes_Resource $resource); - + /** * Returns a list of rights ids * diff --git a/core/data/permission/PermissionManager.php b/core/data/permission/PermissionManager.php index ce326a848..0646b3e18 100644 --- a/core/data/permission/PermissionManager.php +++ b/core/data/permission/PermissionManager.php @@ -36,8 +36,8 @@ */ class PermissionManager { - const CONFIG_KEY = 'permissions'; - + public const CONFIG_KEY = 'permissions'; + /** * @return PermissionInterface * @deprecated @@ -59,7 +59,7 @@ public static function setPermissionModel(PermissionInterface $model) { return ServiceManager::getServiceManager()->register(PermissionInterface::SERVICE_ID, $model); } - + public static function catchEvent(Event $event) { if ($event instanceof ResourceCreated) { diff --git a/core/data/permission/ReverseRightLookupInterface.php b/core/data/permission/ReverseRightLookupInterface.php index aa3a69c8b..5803e13a9 100644 --- a/core/data/permission/ReverseRightLookupInterface.php +++ b/core/data/permission/ReverseRightLookupInterface.php @@ -1,4 +1,5 @@ $persmissionMdels]); } - + public function __construct($options = []) { parent::__construct($options); } - + protected function getInner() { return $this->getOption('inner'); } - - + + /** * (non-PHPdoc) * @see PermissionInterface::getPermissions() */ public function getPermissions(User $user, array $resourceIds) { - + $results = []; foreach ($this->getInner() as $impl) { $results[] = $impl->getPermissions($user, $resourceIds); } - + $rights = []; foreach ($resourceIds as $id) { $intersect = null; @@ -78,10 +78,10 @@ public function getPermissions(User $user, array $resourceIds) } $rights[$id] = array_values($intersect); } - + return $rights; } - + /** * (non-PHPdoc) * @see PermissionInterface::onResourceCreated() @@ -92,7 +92,7 @@ public function onResourceCreated(\core_kernel_classes_Resource $resource) $impl->onResourceCreated($resource); } } - + /** * (non-PHPdoc) * @see PermissionInterface::getSupportedPermissions() @@ -102,12 +102,12 @@ public function getSupportedRights() $models = $this->getInner(); $first = array_pop($models); $supported = $first->getSupportedRights(); - + while (!empty($models)) { $model = array_pop($models); $supported = array_intersect($supported, $model->getSupportedRights()); } - + return array_values($supported); } } diff --git a/core/data/permission/implementation/IntersectionUnionSupported.php b/core/data/permission/implementation/IntersectionUnionSupported.php index 3d290e5b4..7f5f71d4d 100644 --- a/core/data/permission/implementation/IntersectionUnionSupported.php +++ b/core/data/permission/implementation/IntersectionUnionSupported.php @@ -33,8 +33,6 @@ */ class IntersectionUnionSupported extends ConfigurableService implements PermissionInterface { - - /** * @param PermissionInterface $service * @return $this @@ -70,8 +68,8 @@ protected function getInner() } return $results; } - - + + /** * (non-PHPdoc) * @see PermissionInterface::getPermissions() @@ -103,10 +101,10 @@ public function getPermissions(User $user, array $resourceIds) } $rights[$id] = array_values($intersect); } - + return $rights; } - + /** * (non-PHPdoc) * @see PermissionInterface::onResourceCreated() @@ -117,7 +115,7 @@ public function onResourceCreated(\core_kernel_classes_Resource $resource) $impl->onResourceCreated($resource); } } - + /** * (non-PHPdoc) * @see PermissionInterface::getSupportedPermissions() diff --git a/core/data/permission/implementation/NoAccess.php b/core/data/permission/implementation/NoAccess.php index 0f43bee9e..75f1fdc1f 100644 --- a/core/data/permission/implementation/NoAccess.php +++ b/core/data/permission/implementation/NoAccess.php @@ -42,7 +42,7 @@ class NoAccess extends ConfigurableService implements PermissionInterface public function __construct() { } - + /** * (non-PHPdoc) * @see PermissionInterface::getPermissions() @@ -51,7 +51,7 @@ public function getPermissions(User $user, array $resourceIds) { return array_fill_keys($resourceIds, []); } - + /** * (non-PHPdoc) * @see PermissionInterface::onResourceCreated() @@ -60,7 +60,7 @@ public function onResourceCreated(\core_kernel_classes_Resource $resource) { // do nothing } - + /** * (non-PHPdoc) * @see PermissionInterface::getSupportedRights() diff --git a/core/fileReference/FileReferenceSerializer.php b/core/fileReference/FileReferenceSerializer.php index 2aed80cce..506a4be1b 100644 --- a/core/fileReference/FileReferenceSerializer.php +++ b/core/fileReference/FileReferenceSerializer.php @@ -6,7 +6,7 @@ interface FileReferenceSerializer { - const SERVICE_ID = 'generis/fileReferenceSerializer'; + public const SERVICE_ID = 'generis/fileReferenceSerializer'; /** * Serialize filesystem abstraction to a serial @@ -32,7 +32,7 @@ public function unserialize($serial); * @return \oat\oatbox\filesystem\File */ public function unserializeFile($serial); - + /** * Get the \oat\oatbox\filesystem\Directory associated to the serial * diff --git a/core/fileReference/ResourceFileSerializer.php b/core/fileReference/ResourceFileSerializer.php index 45f4214fc..5ceaf6fe5 100644 --- a/core/fileReference/ResourceFileSerializer.php +++ b/core/fileReference/ResourceFileSerializer.php @@ -37,9 +37,9 @@ class ResourceFileSerializer extends ConfigurableService implements FileReferenc { use OntologyAwareTrait; - const RESOURCE_FILE_FILESYSTEM_URI = 'fileSystemUri'; - const RESOURCE_FILE_PATH = 'path'; - const RESOURCE_FILE_NAME = 'fileName'; + public const RESOURCE_FILE_FILESYSTEM_URI = 'fileSystemUri'; + public const RESOURCE_FILE_PATH = 'path'; + public const RESOURCE_FILE_NAME = 'fileName'; /** * @see FileReferenceSerializer::serialize diff --git a/core/kernel/api/class.ModelExporter.php b/core/kernel/api/class.ModelExporter.php index aa1f73bd8..f2a1ebb32 100755 --- a/core/kernel/api/class.ModelExporter.php +++ b/core/kernel/api/class.ModelExporter.php @@ -26,7 +26,6 @@ class core_kernel_api_ModelExporter { - /** * Export the entire ontology * diff --git a/core/kernel/api/class.ModelFactory.php b/core/kernel/api/class.ModelFactory.php index b19405bc8..23f045c50 100644 --- a/core/kernel/api/class.ModelFactory.php +++ b/core/kernel/api/class.ModelFactory.php @@ -46,9 +46,9 @@ public function createModel($namespace, $data) } else { $modelDefinition->parse($data); } - + $data = $modelDefinition->serialise(Format::getFormat('php')); - + foreach ($data as $subjectUri => $propertiesValues) { foreach ($propertiesValues as $prop => $values) { foreach ($values as $k => $v) { @@ -56,10 +56,10 @@ public function createModel($namespace, $data) } } } - + return true; } - + /** * Adds a statement to the ontology if it does not exist yet * @@ -76,7 +76,7 @@ private function addStatement($modelId, $subject, $predicate, $object, $lang = n 'SELECT count(*) FROM statements WHERE modelid = ? AND subject = ? AND predicate = ? AND object = ? AND l_language = ?', [$modelId, $subject, $predicate, $object, (is_null($lang)) ? '' : $lang] ); - + if (intval($result->fetchColumn()) === 0) { $dbWrapper = core_kernel_classes_DbWrapper::singleton(); $date = $dbWrapper->getPlatForm()->getNowExpression(); diff --git a/core/kernel/api/interface.Api.php b/core/kernel/api/interface.Api.php index 292f54574..c68875aa9 100644 --- a/core/kernel/api/interface.Api.php +++ b/core/kernel/api/interface.Api.php @@ -1,4 +1,5 @@ retrieveOrCreateSubClassByLabel($label); } diff --git a/core/kernel/classes/class.ClassFactory.php b/core/kernel/classes/class.ClassFactory.php index 9f2824e06..9eab30039 100644 --- a/core/kernel/classes/class.ClassFactory.php +++ b/core/kernel/classes/class.ClassFactory.php @@ -23,7 +23,7 @@ use oat\generis\model\OntologyRdf; use oat\generis\model\OntologyRdfs; - + /** * Short description of class core_kernel_classes_ClassFactory * @@ -58,15 +58,15 @@ public static function createInstance(core_kernel_classes_Class $clazz, $label = $newUri = (!empty($uri)) ? self::checkProvidedUri($uri) : common_Utils::getNewUri(); $newResource = new core_kernel_classes_Class($newUri); $propertiesValues = [OntologyRdf::RDF_TYPE => $clazz->getUri()]; - + if (!empty($label)) { $propertiesValues[OntologyRdfs::RDFS_LABEL] = $label; } - + if (!empty($comment)) { $propertiesValues[OntologyRdfs::RDFS_COMMENT] = $comment; } - + $check = $newResource->setPropertiesValues($propertiesValues); if ($check) { $returnValue = $newResource; @@ -75,7 +75,7 @@ public static function createInstance(core_kernel_classes_Class $clazz, $label = throw new common_Exception($msg); common_Logger::e($msg); } - + return $returnValue; } @@ -104,7 +104,7 @@ public static function createProperty(core_kernel_classes_Class $clazz, $label = $returnValue->setLgDependent($isLgDependent); } - + return $returnValue; } @@ -150,7 +150,7 @@ private static function checkProvidedUri($uri) } else { $returnValue = common_Utils::getNewUri(); } - + return (string) $returnValue; } diff --git a/core/kernel/classes/class.ClassIterator.php b/core/kernel/classes/class.ClassIterator.php index e46cf9ec6..88a54639b 100644 --- a/core/kernel/classes/class.ClassIterator.php +++ b/core/kernel/classes/class.ClassIterator.php @@ -1,4 +1,5 @@ rewind(); } - + /** * (non-PHPdoc) * @see Iterator::rewind() */ - function rewind() + public function rewind() { $this->currentId = -1; $this->next(); } - + /** * (non-PHPdoc) * @see Iterator::current() */ - function current() + public function current() { return new \core_kernel_classes_Class($this->classes[$this->currentId]); } - + /** * (non-PHPdoc) * @see Iterator::key() */ - function key() + public function key() { return $this->currentId; } - + /** * (non-PHPdoc) * @see Iterator::next() */ - function next() + public function next() { $this->currentId++; if (!isset($this->classes[$this->currentId]) && !empty($this->todoClasses)) { @@ -98,12 +98,12 @@ function next() } } } - + /** * (non-PHPdoc) * @see Iterator::valid() */ - function valid() + public function valid() { return isset($this->classes[$this->currentId]); } diff --git a/core/kernel/classes/class.Container.php b/core/kernel/classes/class.Container.php index b2e7fbfe7..84aca3ada 100644 --- a/core/kernel/classes/class.Container.php +++ b/core/kernel/classes/class.Container.php @@ -1,4 +1,5 @@ sequence = array_merge($this->sequence, $collection->sequence); - + return $returnValue; } @@ -84,10 +85,10 @@ public function intersect(common_Collection $collection) { $returnValue = null; - - $returnValue = new core_kernel_classes_ContainerCollection(new common_Object(__METHOD__)); - $returnValue->sequence = array_uintersect($this->sequence, $collection->sequence, 'core_kernel_classes_ContainerComparator::compare'); - + + $returnValue = new core_kernel_classes_ContainerCollection(new common_Object(__METHOD__)); + $returnValue->sequence = array_uintersect($this->sequence, $collection->sequence, 'core_kernel_classes_ContainerComparator::compare'); + return $returnValue; } @@ -104,7 +105,7 @@ public function indexOf(common_Object $resource) { $returnValue = null; - + $returnValue = -1; foreach ($this->sequence as $index => $_resource) { if ($_resource instanceof core_kernel_classes_Resource) { @@ -113,7 +114,7 @@ public function indexOf(common_Object $resource) } } } - + return $returnValue; } @@ -129,9 +130,9 @@ public function __toString() { $returnValue = (string) ''; - + $returnValue = 'Collection containning ' . $this->count() . ' elements' ; - + return (string) $returnValue; } diff --git a/core/kernel/classes/class.ContainerComparator.php b/core/kernel/classes/class.ContainerComparator.php index e134981c5..4660c7ba0 100644 --- a/core/kernel/classes/class.ContainerComparator.php +++ b/core/kernel/classes/class.ContainerComparator.php @@ -1,4 +1,5 @@ literal, $o2->literal); } elseif ($o1 instanceof core_kernel_classes_Resource && $o2 instanceof core_kernel_classes_Resource) { @@ -58,7 +59,7 @@ public static function compare(core_kernel_classes_Container $o1, core_kernel_cl } else { throw new common_Exception('try to compared not implemented type'); } - + return (int) $returnValue; } diff --git a/core/kernel/classes/class.DbWrapper.php b/core/kernel/classes/class.DbWrapper.php index 42b87572b..c276705a5 100644 --- a/core/kernel/classes/class.DbWrapper.php +++ b/core/kernel/classes/class.DbWrapper.php @@ -1,4 +1,5 @@ persistence->query($statement, $params); - + if (!empty($sth)) { $returnValue = $sth; } @@ -218,13 +219,13 @@ public function query($statement, $params = []) public function exec($statement, $params = []) { $this->debug($statement); - + $returnValue = $this->persistence->exec($statement, $params); $this->incrementNrOfQueries(); return (int) $returnValue; } - + /** * @author "Lionel Lecaque, " * @param string $tableName @@ -251,8 +252,8 @@ public function getTables() } - - + + /** * Returns the column names of a given table * @@ -373,7 +374,7 @@ public function getPlatForm() } return $this->platform; } - + /** * @author "Lionel Lecaque, " * return common_persistence_sql_SchemaManager @@ -474,7 +475,7 @@ public function getRowCount($tableName, $column = 'id') $result->closeCursor(); return (int) $returnValue; } - + /** * Convenience access to lastInsertId. * @@ -486,7 +487,7 @@ public function lastInsertId($name = null) { return $this->persistence->lastInsertId($name); } - + /** * Convenience access to platForm quote. * @@ -499,7 +500,7 @@ public function quote($parameter) { return $this->persistence->quote($parameter); } - + public function quoteIdentifier($parameter) { return $this->persistence->getPlatForm()->quoteIdentifier($parameter); diff --git a/core/kernel/classes/class.EmptyProperty.php b/core/kernel/classes/class.EmptyProperty.php index 4935e24a9..0d2eebb04 100755 --- a/core/kernel/classes/class.EmptyProperty.php +++ b/core/kernel/classes/class.EmptyProperty.php @@ -1,4 +1,5 @@ literal = strval($literal); } @@ -70,9 +71,9 @@ public function __toString() { $returnValue = (string) ''; - + $returnValue = $this->literal; - + return (string) $returnValue; } diff --git a/core/kernel/classes/class.MultiplePropertyValuesException.php b/core/kernel/classes/class.MultiplePropertyValuesException.php index 35350671e..dee557684 100644 --- a/core/kernel/classes/class.MultiplePropertyValuesException.php +++ b/core/kernel/classes/class.MultiplePropertyValuesException.php @@ -1,4 +1,5 @@ resource = $resource; $this->property = $property; - + parent::__construct('Property ( ' . $property->getUri() . ' ) of resource ' . ' ( ' . $resource->getUri() . ' ) has more than one value do not use getUniquePropertyValue but use getPropertyValue instead'); } diff --git a/core/kernel/classes/class.Resource.php b/core/kernel/classes/class.Resource.php index 69064c7f7..bf1760aeb 100644 --- a/core/kernel/classes/class.Resource.php +++ b/core/kernel/classes/class.Resource.php @@ -214,10 +214,11 @@ public function getLabel() $label = $this->getOnePropertyValue($this->getProperty(OntologyRdfs::RDFS_LABEL)); $this->label = is_null($label) ? '' - : ($label instanceof core_kernel_classes_Resource + : ( + $label instanceof core_kernel_classes_Resource ? $label->getUri() : (string)$label - ) + ) ; } diff --git a/core/kernel/classes/class.ResourceFactory.php b/core/kernel/classes/class.ResourceFactory.php index 06984e52b..30a533a1d 100644 --- a/core/kernel/classes/class.ResourceFactory.php +++ b/core/kernel/classes/class.ResourceFactory.php @@ -20,9 +20,9 @@ * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); * 2017 (update and modification) Open Assessment Technologies SA (under the project TAO-PRODUCT); */ - + use oat\generis\model\OntologyRdfs; - + /** * Short description of class core_kernel_classes_ResourceFactory * @@ -58,11 +58,11 @@ public static function create(core_kernel_classes_Class $type, $label = '', $com if (!empty($label)) { $propertiesValues[OntologyRdfs::RDFS_LABEL] = $label; } - + if (!empty($comment)) { $propertiesValues[OntologyRdfs::RDFS_COMMENT] = $comment; } - + $returnValue = $type->createInstanceWithProperties($propertiesValues); return $returnValue; } diff --git a/core/kernel/classes/class.ResourceFormatter.php b/core/kernel/classes/class.ResourceFormatter.php index ed5bc8827..7274b198e 100644 --- a/core/kernel/classes/class.ResourceFormatter.php +++ b/core/kernel/classes/class.ResourceFormatter.php @@ -1,4 +1,5 @@ propertiesValuestoStdClasses($propertiesValues); - } else //get effective triples and map the returned information into the same structure - { + } else { //get effective triples and map the returned information into the same structure $triples = $resource->getRdfTriples(); if (count($triples) == 0) { throw new common_exception_NoContent(); @@ -56,12 +53,12 @@ public function getResourceDescription(core_kernel_classes_Resource $resource, $ } $propertiesValuesStdClasses = $this->propertiesValuestoStdClasses($properties); } - + $returnValue->uri = $resource->getUri(); $returnValue->properties = $propertiesValuesStdClasses; return $returnValue; } - + /** * small helper provide more convenient data structure for propertiesValues for exchange * @return array diff --git a/core/kernel/classes/class.ResourceIterator.php b/core/kernel/classes/class.ResourceIterator.php index e64163194..8cad087f1 100644 --- a/core/kernel/classes/class.ResourceIterator.php +++ b/core/kernel/classes/class.ResourceIterator.php @@ -1,4 +1,5 @@ classIterator = new core_kernel_classes_ClassIterator($classes); } - + /** * (non-PHPdoc) * @see Iterator::rewind() */ - function rewind() + public function rewind() { if (!$this->unmoved) { $this->classIterator->rewind(); @@ -100,16 +101,16 @@ public function current() * (non-PHPdoc) * @see Iterator::key() */ - function key() + public function key() { return $this->classIterator->key() . '#' . $this->currentInstance; } - + /** * (non-PHPdoc) * @see Iterator::next() */ - function next() + public function next() { $this->unmoved = false; if ($this->valid()) { @@ -117,7 +118,7 @@ function next() if (!isset($this->instanceCache[$this->currentInstance])) { // try to load next block (unless we know it's empty) $remainingInstances = !$this->endOfClass && $this->load($this->classIterator->current(), $this->currentInstance); - + // endOfClass or failed loading if (!$remainingInstances) { $this->classIterator->next(); @@ -126,21 +127,21 @@ function next() } } } - + /** * While there are remaining classes there are instances to load * * (non-PHPdoc) * @see Iterator::valid() */ - function valid() + public function valid() { if ($this->instanceCache === null) { $this->ensureNotEmpty(); } return $this->classIterator->valid(); } - + // Helpers /** @@ -170,9 +171,9 @@ protected function load(core_kernel_classes_Class $class, $offset) $this->instanceCache[$offset] = $resource->getUri(); $offset++; } - + $this->endOfClass = count($results) < self::CACHE_SIZE; - + return count($results) > 0; } diff --git a/core/kernel/classes/class.Triple.php b/core/kernel/classes/class.Triple.php index a26a56def..1db533a07 100644 --- a/core/kernel/classes/class.Triple.php +++ b/core/kernel/classes/class.Triple.php @@ -1,4 +1,5 @@ login($login, $password, $role); - + return (bool) $returnValue; } @@ -78,9 +78,9 @@ public function logOut() { $returnValue = (bool) false; - + core_kernel_users_Service::singleton()->logout(); - + return (bool) $returnValue; } diff --git a/core/kernel/impl/class.ApiModelOO.php b/core/kernel/impl/class.ApiModelOO.php index e4652352d..f353ad4b3 100644 --- a/core/kernel/impl/class.ApiModelOO.php +++ b/core/kernel/impl/class.ApiModelOO.php @@ -1,4 +1,5 @@ load($modelId, $file); } - + /** * @see IteratorAggregate::getIterator() */ @@ -50,7 +50,7 @@ public function getIterator(): ArrayIterator { return new ArrayIterator($this->triples); } - + /** * load triples from rdf file * @@ -61,7 +61,7 @@ protected function load($modelId, $file) { $easyRdf = new Graph(); $easyRdf->parseFile($file); - + foreach ($easyRdf->toRdfPhp() as $subject => $propertiesValues) { foreach ($propertiesValues as $predicate => $values) { foreach ($values as $v) { diff --git a/core/kernel/persistence/file/FileModel.php b/core/kernel/persistence/file/FileModel.php index 44dc82785..6acba77eb 100755 --- a/core/kernel/persistence/file/FileModel.php +++ b/core/kernel/persistence/file/FileModel.php @@ -24,8 +24,8 @@ use EasyRdf\Format; use EasyRdf\Graph; use oat\generis\model\data\Model; -use \common_exception_MissingParameter; -use \common_exception_Error; +use common_exception_MissingParameter; +use common_exception_Error; use core_kernel_persistence_smoothsql_SmoothModel as SmoothModel; /** @@ -42,7 +42,7 @@ class FileModel implements Model * @var string */ private $file; - + public static function fromFile($filePath) { return new self(['file' => $filePath]); @@ -66,7 +66,7 @@ public static function toFile($filePath, $triples) $format = Format::getFormat('rdfxml'); return file_put_contents($filePath, $graph->serialise($format)); } - + /** * Constructor of the smooth model, expects a persistence in the configuration * @@ -80,7 +80,7 @@ public function __construct($options = []) } $this->file = $options['file']; } - + /** * (non-PHPdoc) * @see \oat\generis\model\data\Model::getConfig() @@ -91,7 +91,7 @@ public function getOptions() 'file' => $this->file ]; } - + /** * (non-PHPdoc) * @see \oat\generis\model\data\Model::getRdfInterface() @@ -100,7 +100,7 @@ public function getRdfInterface() { return new FileRdf($this->file); } - + /** * (non-PHPdoc) * @see \oat\generis\model\data\Model::getRdfsInterface() @@ -109,7 +109,7 @@ public function getRdfsInterface() { throw new \common_exception_NoImplementation('Rdfs interface not implemented for ' . __CLASS__); } - + /** * (non-PHPdoc) * @see \oat\generis\model\data\Model::getSearchInterface() @@ -120,7 +120,7 @@ public function getSearchInterface() } // helper - + /** * @deprecated * @@ -129,6 +129,6 @@ public function getSearchInterface() */ public static function getModelIdFromXml($file) { - return SmoothModel::DEFAULT_READ_ONLY_MODEL; + return SmoothModel::DEFAULT_READ_ONLY_MODEL; } } diff --git a/core/kernel/persistence/file/FileRdf.php b/core/kernel/persistence/file/FileRdf.php index 171b9dfc3..78b2cb43a 100644 --- a/core/kernel/persistence/file/FileRdf.php +++ b/core/kernel/persistence/file/FileRdf.php @@ -35,12 +35,12 @@ class FileRdf implements RdfInterface * @var string */ private $file; - + public function __construct($file) { $this->file = $file; } - + /** * (non-PHPdoc) * @see \oat\generis\model\data\RdfInterface::get() @@ -49,7 +49,7 @@ public function get($subject, $predicate) { throw new \common_Exception('Not implemented'); } - + /** * (non-PHPdoc) * @see \oat\generis\model\data\RdfInterface::add() @@ -58,7 +58,7 @@ public function add(\core_kernel_classes_Triple $triple) { throw new \common_Exception('Not implemented'); } - + /** * (non-PHPdoc) * @see \oat\generis\model\data\RdfInterface::remove() @@ -67,7 +67,7 @@ public function remove(\core_kernel_classes_Triple $triple) { throw new \common_Exception('Not implemented'); } - + /** * (non-PHPdoc) * @see \oat\generis\model\data\RdfInterface::search() @@ -76,7 +76,7 @@ public function search($predicate, $object) { throw new \common_Exception('Not implemented'); } - + public function getIterator() { return new FileIterator($this->file); diff --git a/core/kernel/persistence/interface.ClassInterface.php b/core/kernel/persistence/interface.ClassInterface.php index 46374d6c4..3227476ab 100644 --- a/core/kernel/persistence/interface.ClassInterface.php +++ b/core/kernel/persistence/interface.ClassInterface.php @@ -1,4 +1,5 @@ $this->getUniquePrimaryKey()] + parent::tripleToValue($triple); } @@ -86,7 +86,7 @@ protected function tripleToValue(core_kernel_classes_Triple $triple) : array * * @return array */ - protected function getTripleParameterTypes() : array + protected function getTripleParameterTypes(): array { return array_merge( [ diff --git a/core/kernel/persistence/smoothsql/class.Class.php b/core/kernel/persistence/smoothsql/class.Class.php index 253a9b9be..2699ec423 100644 --- a/core/kernel/persistence/smoothsql/class.Class.php +++ b/core/kernel/persistence/smoothsql/class.Class.php @@ -93,19 +93,19 @@ private function getRecursiveSubClasses(core_kernel_classes_Class $resource) public function isSubClassOf(core_kernel_classes_Class $resource, core_kernel_classes_Class $parentClass) { $returnValue = false; - + $query = 'SELECT object FROM statements WHERE subject = ? AND predicate = ? AND ' . $this->getPersistence()->getPlatForm()->getObjectTypeCondition() . ' = ?'; $result = $this->getPersistence()->query($query, [ $resource->getUri(), OntologyRdfs::RDFS_SUBCLASSOF, $parentClass->getUri() ]); - + while ($row = $result->fetch()) { $returnValue = true; break; } - + if (!$returnValue) { $parentSubClasses = $parentClass->getSubClasses(true); foreach ($parentSubClasses as $subClass) { @@ -115,7 +115,7 @@ public function isSubClassOf(core_kernel_classes_Class $resource, core_kernel_cl } } } - + return $returnValue; } @@ -126,14 +126,14 @@ public function isSubClassOf(core_kernel_classes_Class $resource, core_kernel_cl public function getParentClasses(core_kernel_classes_Class $resource, $recursive = false) { $returnValue = []; - + $sqlQuery = 'SELECT object FROM statements WHERE subject = ? AND predicate = ?'; $sqlResult = $this->getPersistence()->query($sqlQuery, [$resource->getUri(), OntologyRdfs::RDFS_SUBCLASSOF]); while ($row = $sqlResult->fetch()) { $parentClass = $this->getModel()->getClass($row['object']); - + $returnValue[$parentClass->getUri()] = $parentClass ; if ($recursive == true && $parentClass->getUri() != OntologyRdfs::RDFS_CLASS && $parentClass->getUri() != OntologyRdfs::RDFS_RESOURCE) { if ($parentClass->getUri() == GenerisRdf::CLASS_GENERIS_RESOURCE) { @@ -155,18 +155,18 @@ public function getParentClasses(core_kernel_classes_Class $resource, $recursive public function getProperties(core_kernel_classes_Class $resource, $recursive = false) { $returnValue = []; - + $sqlQuery = 'SELECT subject FROM statements WHERE predicate = ? AND ' . $this->getPersistence()->getPlatForm()->getObjectTypeCondition() . ' = ?'; $sqlResult = $this->getPersistence()->query($sqlQuery, [ OntologyRdfs::RDFS_DOMAIN, $resource->getUri() ]); - + while ($row = $sqlResult->fetch()) { $property = $this->getModel()->getProperty($row['subject']); $returnValue[$property->getUri()] = $property; } - + if ($recursive == true) { $parentClasses = $this->getParentClasses($resource, true); foreach ($parentClasses as $parent) { @@ -175,7 +175,7 @@ public function getProperties(core_kernel_classes_Class $resource, $recursive = } } } - + return $returnValue; } @@ -186,17 +186,17 @@ public function getProperties(core_kernel_classes_Class $resource, $recursive = public function getInstances(core_kernel_classes_Class $resource, $recursive = false, $params = []) { $returnValue = []; - + $params = array_merge($params, ['like' => false, 'recursive' => $recursive]); - + $query = $this->getFilteredQuery($resource, [], $params); $result = $this->getPersistence()->query($query); - + while ($row = $result->fetch()) { $foundInstancesUri = $row['subject']; $returnValue[$foundInstancesUri] = $this->getModel()->getResource($foundInstancesUri); } - + return $returnValue; } @@ -261,10 +261,10 @@ public function createInstance(core_kernel_classes_Class $resource, $label = '', if ($uri == '') { $subject = $this->getServiceLocator()->get(UriProvider::SERVICE_ID)->provide(); } elseif ($uri[0] == '#') { //$uri should start with # and be well formed - $modelUri = common_ext_NamespaceManager::singleton()->getLocalNamespace()->getUri(); - $subject = rtrim($modelUri, '#') . $uri; + $modelUri = common_ext_NamespaceManager::singleton()->getLocalNamespace()->getUri(); + $subject = rtrim($modelUri, '#') . $uri; } else { - $subject = $uri; + $subject = $uri; } $returnValue = $this->getModel()->getResource($subject); @@ -304,7 +304,7 @@ public function createSubClass(core_kernel_classes_Class $resource, $label = '', if (!empty($comment)) { $properties[OntologyRdfs::RDFS_COMMENT] = $comment; } - + $returnValue->setPropertiesValues($properties); return $returnValue; } @@ -349,20 +349,20 @@ public function createProperty(core_kernel_classes_Class $resource, $label = '', public function searchInstances(core_kernel_classes_Class $resource, $propertyFilters = [], $options = []) { $returnValue = []; - + // Avoid a 'like' search on OntologyRdf::RDF_TYPE! if (count($propertyFilters) === 0) { $options = array_merge($options, ['like' => false]); } - + $query = $this->getFilteredQuery($resource, $propertyFilters, $options); $result = $this->getPersistence()->query($query); - + while ($row = $result->fetch()) { $foundInstancesUri = $row['subject']; $returnValue[$foundInstancesUri] = $this->getModel()->getResource($foundInstancesUri); } - + return $returnValue; } @@ -375,15 +375,15 @@ public function countInstances(core_kernel_classes_Class $resource, $propertyFil if (isset($options['offset'])) { unset($options['offset']); } - + if (isset($options['limit'])) { unset($options['limit']); } - + if (isset($options['order'])) { unset($options['order']); } - + $query = 'SELECT count(subject) FROM (' . $this->getFilteredQuery($resource, $propertyFilters, $options) . ') as countq'; return (int)$this->getPersistence()->query($query)->fetchColumn(); } @@ -395,28 +395,28 @@ public function countInstances(core_kernel_classes_Class $resource, $propertyFil public function getInstancesPropertyValues(core_kernel_classes_Class $resource, core_kernel_classes_Property $property, $propertyFilters = [], $options = []) { $returnValue = []; - + $distinct = isset($options['distinct']) ? $options['distinct'] : false; - + if (count($propertyFilters) === 0) { $options = array_merge($options, ['like' => false]); } - + $filteredQuery = $this->getFilteredQuery($resource, $propertyFilters, $options); - + // Get all the available property values in the subset of instances $query = 'SELECT'; if ($distinct) { $query .= ' DISTINCT'; } - + $query .= " object FROM (SELECT overq.subject, valuesq.object FROM (${filteredQuery}) as overq JOIN statements AS valuesq ON (overq.subject = valuesq.subject AND valuesq.predicate = ?)) AS overrootq"; - + $sqlResult = $this->getPersistence()->query($query, [$property->getUri()]); while ($row = $sqlResult->fetch()) { $returnValue[] = common_Utils::toResource($row['object']); } - + return (array) $returnValue; } @@ -444,11 +444,11 @@ public function createInstanceWithProperties(core_kernel_classes_Class $type, $p if (isset($properties[OntologyRdf::RDF_TYPE])) { throw new core_kernel_persistence_Exception('Additional types in createInstanceWithProperties not permited'); } - + $properties[OntologyRdf::RDF_TYPE] = $type; $returnValue = $this->getModel()->getResource($this->getServiceLocator()->get(UriProvider::SERVICE_ID)->provide()); $returnValue->setPropertiesValues($properties); - + return $returnValue; } @@ -462,21 +462,21 @@ public function deleteInstances(core_kernel_classes_Class $resource, $resources, $class = $this->getModel()->getClass($resource->getUri()); $uris = []; - + foreach ($resources as $r) { $uri = (($r instanceof core_kernel_classes_Resource) ? $r->getUri() : $r); $uris[] = $this->getPersistence()->quote($uri); } - + if ($class->exists()) { $inValues = implode(',', $uris); $query = 'DELETE FROM statements WHERE subject IN (' . $inValues . ')'; - + if (true === $deleteReference) { $params[] = $resource->getUri(); $query .= ' OR object IN (' . $inValues . ')'; } - + try { // Even if now rows are affected, we consider the resources // as deleted. @@ -500,14 +500,14 @@ public function deleteInstances(core_kernel_classes_Class $resource, $resources, public function getFilteredQuery(core_kernel_classes_Class $resource, $propertyFilters = [], $options = []) { $rdftypes = []; - + // Check recursivity... if (isset($options['recursive']) && $options['recursive']) { foreach ($this->getSubClasses($resource, $options['recursive']) as $subClass) { $rdftypes[] = $subClass->getUri(); } } - + // Check additional classes... if (isset($options['additionalClasses'])) { foreach ($options['additionalClasses'] as $aC) { @@ -515,7 +515,7 @@ public function getFilteredQuery(core_kernel_classes_Class $resource, $propertyF $rdftypes = array_unique($rdftypes); } } - + // Add the class type of the given class if (!in_array($resource->getUri(), $rdftypes)) { $rdftypes[] = $resource->getUri(); diff --git a/core/kernel/persistence/smoothsql/class.Exception.php b/core/kernel/persistence/smoothsql/class.Exception.php index 438c03b22..63ff991b5 100644 --- a/core/kernel/persistence/smoothsql/class.Exception.php +++ b/core/kernel/persistence/smoothsql/class.Exception.php @@ -1,4 +1,5 @@ removePropertyValues($resource, $multipleProperty); $this->setPropertyValue($resource, $multipleProperty, $value); } @@ -184,7 +184,7 @@ public function setLgDependent(core_kernel_classes_Resource $resource, $isLgDepe { $lgDependentProperty = new core_kernel_classes_Property(GenerisRdf::PROPERTY_IS_LG_DEPENDENT, __METHOD__); - $value = ((bool)$isLgDependent) ? GenerisRdf::GENERIS_TRUE : GenerisRdf::GENERIS_FALSE ; + $value = ((bool)$isLgDependent) ? GenerisRdf::GENERIS_TRUE : GenerisRdf::GENERIS_FALSE ; $this->removePropertyValues($resource, $lgDependentProperty); $this->setPropertyValue($resource, $lgDependentProperty, $value); } diff --git a/core/kernel/persistence/smoothsql/class.Resource.php b/core/kernel/persistence/smoothsql/class.Resource.php index bf96ea7b7..c9dab97c1 100644 --- a/core/kernel/persistence/smoothsql/class.Resource.php +++ b/core/kernel/persistence/smoothsql/class.Resource.php @@ -37,7 +37,6 @@ */ class core_kernel_persistence_smoothsql_Resource implements core_kernel_persistence_ResourceInterface { - /** * @var core_kernel_persistence_smoothsql_SmoothModel */ diff --git a/core/kernel/persistence/smoothsql/class.SmoothIterator.php b/core/kernel/persistence/smoothsql/class.SmoothIterator.php index 75ccc5ab6..bf1980573 100644 --- a/core/kernel/persistence/smoothsql/class.SmoothIterator.php +++ b/core/kernel/persistence/smoothsql/class.SmoothIterator.php @@ -1,4 +1,5 @@ modelid = $statement["modelid"]; $triple->subject = $statement["subject"]; diff --git a/core/kernel/persistence/smoothsql/class.SmoothModel.php b/core/kernel/persistence/smoothsql/class.SmoothModel.php index cb4a6e39c..255b9937e 100755 --- a/core/kernel/persistence/smoothsql/class.SmoothModel.php +++ b/core/kernel/persistence/smoothsql/class.SmoothModel.php @@ -36,14 +36,14 @@ */ class core_kernel_persistence_smoothsql_SmoothModel extends ConfigurableService implements Ontology, SchemaProviderInterface { - const OPTION_PERSISTENCE = 'persistence'; - const OPTION_READABLE_MODELS = 'readable'; - const OPTION_WRITEABLE_MODELS = 'writeable'; - const OPTION_NEW_TRIPLE_MODEL = 'addTo'; - const OPTION_SEARCH_SERVICE = 'search'; + public const OPTION_PERSISTENCE = 'persistence'; + public const OPTION_READABLE_MODELS = 'readable'; + public const OPTION_WRITEABLE_MODELS = 'writeable'; + public const OPTION_NEW_TRIPLE_MODEL = 'addTo'; + public const OPTION_SEARCH_SERVICE = 'search'; - const DEFAULT_WRITABLE_MODEL = 1; - const DEFAULT_READ_ONLY_MODEL = 2; + public const DEFAULT_WRITABLE_MODEL = 1; + public const DEFAULT_READ_ONLY_MODEL = 2; /** * Persistence to use for the smoothmodel @@ -52,21 +52,21 @@ class core_kernel_persistence_smoothsql_SmoothModel extends ConfigurableService */ private $persistence; - function getResource($uri) + public function getResource($uri) { $resource = new \core_kernel_classes_Resource($uri); $resource->setModel($this); return $resource; } - function getClass($uri) + public function getClass($uri) { $class = new \core_kernel_classes_Class($uri); $class->setModel($this); return $class; } - function getProperty($uri) + public function getProperty($uri) { $property = new \core_kernel_classes_Property($uri); $property->setModel($this); @@ -211,5 +211,4 @@ public function provideSchema(SchemaCollection $schemaCollection) $schema = $schemaCollection->getSchema($this->getOption(self::OPTION_PERSISTENCE)); SmoothRdsModel::addSmoothTables($schema); } - } diff --git a/core/kernel/persistence/smoothsql/class.SmoothRdf.php b/core/kernel/persistence/smoothsql/class.SmoothRdf.php index 21332ab60..b92adc6f0 100644 --- a/core/kernel/persistence/smoothsql/class.SmoothRdf.php +++ b/core/kernel/persistence/smoothsql/class.SmoothRdf.php @@ -56,17 +56,17 @@ class core_kernel_persistence_smoothsql_SmoothRdf implements RdfInterface * @var core_kernel_persistence_smoothsql_SmoothModel */ private $model; - + public function __construct(core_kernel_persistence_smoothsql_SmoothModel $model) { $this->model = $model; } - + protected function getPersistence() { return $this->model->getPersistence(); } - + /** * (non-PHPdoc) * @see \oat\generis\model\data\RdfInterface::get() @@ -136,7 +136,7 @@ protected function insertValues(array $valuesToInsert) return $this->getPersistence()->insertMultiple('statements', $valuesToInsert, $types); } - + /** * (non-PHPdoc) * @see \oat\generis\model\data\RdfInterface::remove() @@ -146,7 +146,7 @@ public function remove(core_kernel_classes_Triple $triple) $query = "DELETE FROM statements WHERE subject = ? AND predicate = ? AND object = ? AND l_language = ?;"; return $this->getPersistence()->exec($query, [$triple->subject, $triple->predicate, $triple->object, is_null($triple->lg) ? '' : $triple->lg]); } - + /** * (non-PHPdoc) * @see \oat\generis\model\data\RdfInterface::search() @@ -155,7 +155,7 @@ public function search($predicate, $object) { throw new \common_Exception('Not implemented'); } - + public function getIterator() { return new core_kernel_persistence_smoothsql_SmoothIterator($this->getPersistence()); @@ -173,7 +173,7 @@ protected function getModel() * @param core_kernel_classes_Triple $triple * @return array */ - protected function tripleToValue(core_kernel_classes_Triple $triple) : array + protected function tripleToValue(core_kernel_classes_Triple $triple): array { return [ 'modelid' => $triple->modelid, @@ -186,7 +186,7 @@ protected function tripleToValue(core_kernel_classes_Triple $triple) : array ]; } - protected function getTripleParameterTypes() : array + protected function getTripleParameterTypes(): array { return self::TRIPLE_PARAMETER_TYPE; } diff --git a/core/kernel/persistence/smoothsql/class.SmoothRdfs.php b/core/kernel/persistence/smoothsql/class.SmoothRdfs.php index 49dfb0cdc..d05172331 100755 --- a/core/kernel/persistence/smoothsql/class.SmoothRdfs.php +++ b/core/kernel/persistence/smoothsql/class.SmoothRdfs.php @@ -34,12 +34,12 @@ class core_kernel_persistence_smoothsql_SmoothRdfs implements RdfsInterface * @var core_kernel_persistence_smoothsql_SmoothModel */ private $model; - + public function __construct(core_kernel_persistence_smoothsql_SmoothModel $model) { $this->model = $model; } - + /** * (non-PHPdoc) * @see \oat\generis\model\data\RdfsInterface::getClassImplementation() @@ -48,7 +48,7 @@ public function getClassImplementation() { return new \core_kernel_persistence_smoothsql_Class($this->model); } - + /** * (non-PHPdoc) * @see \oat\generis\model\data\RdfsInterface::getResourceImplementation() @@ -57,7 +57,7 @@ public function getResourceImplementation() { return new \core_kernel_persistence_smoothsql_Resource($this->model); } - + /** * (non-PHPdoc) * @see \oat\generis\model\data\RdfsInterface::getPropertyImplementation() diff --git a/core/kernel/persistence/smoothsql/class.Utils.php b/core/kernel/persistence/smoothsql/class.Utils.php index 606505887..039ae9240 100644 --- a/core/kernel/persistence/smoothsql/class.Utils.php +++ b/core/kernel/persistence/smoothsql/class.Utils.php @@ -45,9 +45,9 @@ class core_kernel_persistence_smoothsql_Utils public static function sortByLanguage($persistence, $dataset, $langColname, $selectedLanguage, $defaultLanguage) { $returnValue = []; - + $fallbackLanguage = ''; - + $sortedResults = [ $selectedLanguage => [], $defaultLanguage => [], @@ -60,13 +60,13 @@ public static function sortByLanguage($persistence, $dataset, $langColname, $sel 'language' => $row[$langColname] ]; } - + $returnValue = array_merge( $sortedResults[$selectedLanguage], (count($sortedResults) > 2) ? $sortedResults[$defaultLanguage] : [], $sortedResults[$fallbackLanguage] ); - + return $returnValue; } @@ -82,7 +82,7 @@ public static function getFirstLanguage($values) if (count($values) > 0) { $previousLanguage = $values[0]['language']; - + foreach ($values as $value) { if ($value['language'] == $previousLanguage) { $returnValue[] = $value['value']; @@ -105,10 +105,10 @@ public static function getFirstLanguage($values) public static function filterByLanguage(common_persistence_SqlPersistence $persistence, $dataset, $langColname, $selectedLanguage, $defaultLanguage) { $returnValue = []; - + $result = self::sortByLanguage($persistence, $dataset, $langColname, $selectedLanguage, $defaultLanguage); $returnValue = self::getFirstLanguage($result); - + return $returnValue; } @@ -127,7 +127,7 @@ public static function identifyFirstLanguage($values) if (count($values) > 0) { $previousLanguage = $values[0]['language']; $returnValue = $previousLanguage; - + foreach ($values as $value) { if ($value['language'] == $previousLanguage) { continue; @@ -151,12 +151,12 @@ public static function identifyFirstLanguage($values) public static function buildSearchPattern(common_persistence_SqlPersistence $persistence, $pattern, $like = true) { $returnValue = ''; - + // Take care of RDFS Literals! if ($pattern instanceof core_kernel_classes_Literal) { $pattern = $pattern->__toString(); } - + switch (gettype($pattern)) { case 'object': if ($pattern instanceof core_kernel_classes_Resource) { @@ -165,12 +165,12 @@ public static function buildSearchPattern(common_persistence_SqlPersistence $per common_Logger::w('non ressource as search parameter: ' . get_class($pattern), ['GENERIS']); } break; - + default: $patternToken = $pattern; $wildcard = mb_strpos($patternToken, '*', 0, 'UTF-8') !== false; $object = trim(str_replace('*', '%', $patternToken)); - + if ($like) { if (!$wildcard && !preg_match("/^%/", $object)) { $object = "%" . $object; @@ -187,58 +187,58 @@ public static function buildSearchPattern(common_persistence_SqlPersistence $per } break; } - + return $returnValue; } - + public static function buildPropertyQuery(core_kernel_persistence_smoothsql_SmoothModel $model, $propertyUri, $values, $like, $lang = '') { $persistence = $model->getPersistence(); - + // Deal with predicate... $predicate = $persistence->quote($propertyUri); - + // Deal with values... if (is_array($values) === false) { $values = [$values]; } - + $valuePatterns = []; foreach ($values as $val) { $pattern = $like ? 'LOWER(object) ' : 'object '; $valuePatterns[] = $pattern . self::buildSearchPattern($persistence, $val, $like); } - + $sqlValues = implode(' OR ', $valuePatterns); - + // Deal with language... $sqlLang = ''; if (empty($lang) === false) { $sqlLang = ' AND (' . self::buildLanguagePattern($persistence, $lang) . ')'; } - + $query = "SELECT DISTINCT subject FROM statements WHERE (predicate = ${predicate}) AND (${sqlValues}${sqlLang})" . ' AND modelid IN (' . implode(',', $model->getReadableModels()) . ')'; - + return $query; } - + public static function buildLanguagePattern(common_persistence_SqlPersistence $persistence, $lang = '') { $languagePattern = ''; - + if (empty($lang) === false) { $sqlEmpty = $persistence->quote(''); $sqlLang = $persistence->quote($lang); $languagePattern = "l_language = ${sqlEmpty} OR l_language = ${sqlLang}"; } - + return $languagePattern; } - + public static function buildUnionQuery($propertyQueries) { - + if (count($propertyQueries) === 0) { return false; } elseif (count($propertyQueries) === 1) { @@ -249,11 +249,11 @@ public static function buildUnionQuery($propertyQueries) foreach ($propertyQueries as $query) { $finalPropertyQueries[] = "(${query})"; } - + return implode(' UNION ALL ', $finalPropertyQueries); } } - + public static function buildFilterQuery(core_kernel_persistence_smoothsql_SmoothModel $model, $classUri, array $propertyFilters, $and = true, $like = true, $lang = '', $offset = 0, $limit = 0, $order = '', $orderDir = 'ASC') { @@ -265,7 +265,7 @@ public static function buildFilterQuery(core_kernel_persistence_smoothsql_Smooth if (is_array($classUri) === false) { $classUri = [$classUri]; } - + $propertyQueries = [self::buildPropertyQuery($model, OntologyRdf::RDF_TYPE, $classUri, false)]; foreach ($propertyFilters as $propertyUri => $filterValues) { // no support of Filter object passed in the $propertyFilters array. @@ -274,9 +274,9 @@ public static function buildFilterQuery(core_kernel_persistence_smoothsql_Smooth } $propertyQueries[] = self::buildPropertyQuery($model, $propertyUri, $filterValues, $like, $lang); } - + $unionQuery = self::buildUnionQuery($propertyQueries); - + if (($propCount = count($propertyFilters)) === 0) { $query = self::buildPropertyQuery($model, OntologyRdf::RDF_TYPE, $classUri, false, $lang); } else { @@ -287,34 +287,34 @@ public static function buildFilterQuery(core_kernel_persistence_smoothsql_Smooth // Order... if (!empty($order)) { $orderPredicate = $persistence->quote($order); - + $sqlLang = ''; if (!empty($lang)) { $sqlEmptyLang = $persistence->quote(''); $sqlRequestedLang = $persistence->quote($lang); $sqlLang = " AND (l_language = ${sqlEmptyLang} OR l_language = ${sqlRequestedLang})"; } - + $orderQueryId = $persistence->getPlatForm()->quoteIdentifier('orderq'); $orderQuerySubject = $orderQueryId . '.' . $persistence->getPlatForm()->quoteIdentifier('subject'); $orderQueryObject = $orderQueryId . '.' . $persistence->getPlatForm()->quoteIdentifier('object'); - + $sqlOrderFilter = "mainq.subject = ${orderQuerySubject} AND predicate = ${orderPredicate}${sqlLang}"; - + $query = "SELECT mainq.subject, ${orderQueryObject} FROM (${query}) AS mainq LEFT JOIN "; $query .= "statements AS ${orderQueryId} ON (${sqlOrderFilter}) ORDER BY ${orderQueryObject} ${orderDir}"; } - + // Limit... if ($limit > 0) { $query = $persistence->getPlatForm()->limitStatement($query, $limit, $offset); } - + // Suffix order... if (empty($order) === false) { $query = "SELECT subject FROM (${query}) as rootq"; } - + return $query; } } diff --git a/core/kernel/persistence/smoothsql/install/SmoothRdsModel.php b/core/kernel/persistence/smoothsql/install/SmoothRdsModel.php index 02c68b8e4..c8799b9bc 100644 --- a/core/kernel/persistence/smoothsql/install/SmoothRdsModel.php +++ b/core/kernel/persistence/smoothsql/install/SmoothRdsModel.php @@ -28,7 +28,6 @@ */ class SmoothRdsModel { - /** * * @param Schema $schema @@ -36,12 +35,12 @@ class SmoothRdsModel */ public static function addSmoothTables(Schema $schema) { - $table = $schema->createTable("statements"); + $table = $schema->createTable("statements"); $table->addColumn("modelid", "integer", ["notnull" => true,"default" => 0]); $table->addColumn("subject", "string", ["length" => 255,"default" => null]); $table->addColumn("predicate", "string", ["length" => 255,"default" => null]); $table->addColumn("object", "text", ["default" => null,"notnull" => false]); - + $table->addColumn("l_language", "string", ["length" => 255,"default" => null,"notnull" => false]); $table->addColumn("id", "integer", ["notnull" => true,"autoincrement" => true]); $table->addColumn("author", "string", ["length" => 255,"default" => null,"notnull" => false]); diff --git a/core/kernel/persistence/smoothsql/search/ComplexSearchService.php b/core/kernel/persistence/smoothsql/search/ComplexSearchService.php index 649cc0023..c5a15450b 100755 --- a/core/kernel/persistence/smoothsql/search/ComplexSearchService.php +++ b/core/kernel/persistence/smoothsql/search/ComplexSearchService.php @@ -43,10 +43,9 @@ */ class ComplexSearchService extends ConfigurableService { - - const SERVICE_ID = 'generis/complexSearch'; - - const SERVICE_SEARCH_ID = 'search.tao.gateway'; + public const SERVICE_ID = 'generis/complexSearch'; + + public const SERVICE_SEARCH_ID = 'search.tao.gateway'; /** * internal service locator @@ -87,11 +86,11 @@ protected function getZendServiceManager() protected function getOperator($like) { $operator = 'equals'; - + if ($like) { $operator = 'contains'; } - + return $operator; } @@ -147,14 +146,14 @@ public function searchType(QueryBuilderInterface $query, $class_uri, $recursive } $rdftypes[] = $class_uri; - + $criteria = $query->newQuery() ->add('http://www.w3.org/1999/02/22-rdf-syntax-ns#type') ->in($rdftypes); - + return $criteria; } - + /** * set gateway language options * @param QueryBuilderInterface $query @@ -172,12 +171,12 @@ public function setLanguage(QueryBuilderInterface $query, $userLanguage = '', $d $options['language'] = $userLanguage; } $options['defaultLanguage'] = $defaultLanguage; - + $this->getGateway()->setOptions($options); - + return $query->newQuery(); } - + protected function parseValue($rawValue) { $result = []; @@ -193,7 +192,7 @@ protected function parseValue($rawValue) } return count($result) === 1 ? $result[0] : $result; } - + /** * verify if value is valid * @param string $value @@ -227,17 +226,17 @@ protected function validValue($value) public function getQuery(core_kernel_persistence_smoothsql_SmoothModel $model, $classUri, array $propertyFilters, $and = true, $isLikeOperator = true, $lang = '', $offset = 0, $limit = 0, $order = '', $orderDir = 'ASC') { $query = $this->getGateway()->query()->setLimit($limit)->setOffset($offset); - + if (!empty($order)) { $query->sort([$order => strtolower($orderDir)]); } - + $this->setLanguage($query, $lang); $criteria = $query->newQuery() ->add('http://www.w3.org/1999/02/22-rdf-syntax-ns#type') ->in($classUri); - + $query->setCriteria($criteria); $count = 0; $propertyFilters = FilterFactory::buildFilters($propertyFilters, $isLikeOperator); diff --git a/core/kernel/persistence/smoothsql/search/GateWay.php b/core/kernel/persistence/smoothsql/search/GateWay.php index 2875c27c0..94da8b8fb 100644 --- a/core/kernel/persistence/smoothsql/search/GateWay.php +++ b/core/kernel/persistence/smoothsql/search/GateWay.php @@ -40,7 +40,6 @@ */ class GateWay extends TaoSearchGateWay { - /** * * @var common_persistence_SqlPersistence @@ -60,13 +59,13 @@ class GateWay extends TaoSearchGateWay protected $driverList = [ 'taoRdf' => 'search.driver.tao' ]; - + /** * resultSet service or className * @var string */ protected $resultSetClassName = '\\oat\\generis\\model\\kernel\\persistence\\smoothsql\\search\\TaoResultSet'; - + public function __construct() { $this->connector = ServiceManager::getServiceManager() @@ -85,7 +84,7 @@ public function connect() { return !is_null($this->connector); } - + /** * execute Parsed Query * @@ -116,7 +115,7 @@ protected function statementToArray(Statement $statement) } return $result; } - + public function fetchQuery($query) { $statement = $this->connector->query($query); @@ -136,8 +135,8 @@ public function count(QueryBuilderInterface $Builder) $result = $this->statementToArray($statement); return (int)reset($result)->cpt; } - - + + public function getJoiner() { $joiner = new QueryJoiner(); @@ -146,10 +145,10 @@ public function getJoiner() $joiner->setParent($this); return $joiner; } - + public function join(QueryJoiner $joiner) { - + $query = $joiner->execute(); $statement = $this->connector->query($query); $result = $this->statementToArray($statement); diff --git a/core/kernel/persistence/smoothsql/search/TaoResultSet.php b/core/kernel/persistence/smoothsql/search/TaoResultSet.php index 640340dc8..c6429564d 100644 --- a/core/kernel/persistence/smoothsql/search/TaoResultSet.php +++ b/core/kernel/persistence/smoothsql/search/TaoResultSet.php @@ -33,14 +33,14 @@ class TaoResultSet extends ResultSet implements ResultSetInterface, \oat\search\ { use \oat\search\UsableTrait\ParentFluateTrait; use \oat\generis\model\OntologyAwareTrait; - + /** * * @var \oat\search\QueryBuilder */ protected $countQuery; protected $totalCount = null; - + public function setCountQuery($query) { $this->countQuery = $query; @@ -53,15 +53,15 @@ public function setCountQuery($query) */ public function total() { - + if (is_null($this->totalCount)) { $cpt = $this->getParent()->fetchQuery($this->countQuery); $this->totalCount = intval($cpt['cpt']); } - + return $this->totalCount; } - + /** * return a new resource create from current subject * @return core_kernel_classes_Resource diff --git a/core/kernel/persistence/smoothsql/search/driver/TaoSearchDriver.php b/core/kernel/persistence/smoothsql/search/driver/TaoSearchDriver.php index cb7457e15..ff26e76f1 100644 --- a/core/kernel/persistence/smoothsql/search/driver/TaoSearchDriver.php +++ b/core/kernel/persistence/smoothsql/search/driver/TaoSearchDriver.php @@ -19,7 +19,6 @@ */ class TaoSearchDriver extends EscaperAbstract { - /** * @var common_persistence_SqlPersistence */ @@ -31,7 +30,7 @@ public function __construct() ->get(\common_persistence_Manager::SERVICE_ID) ->getPersistenceById('default'); } - + /** * @inherit */ @@ -46,7 +45,7 @@ public function escape($stringValue) { return $stringValue; } - + /** * return quoted empty string */ @@ -54,7 +53,7 @@ public function getEmpty() { return $this->quote(''); } - + /** * @inherit */ @@ -62,7 +61,7 @@ public function quote($stringValue) { return $this->persistence->quote($stringValue); } - + /** * @inherit */ @@ -70,7 +69,7 @@ public function reserved($stringValue) { return $this->persistence->getPlatForm()->quoteIdentifier($stringValue); } - + /** * @inherit */ @@ -84,15 +83,15 @@ public function random() $name = $this->persistence->getPlatForm()->getName(); return $random[$name]; } - + public function groupAggregation($variable, $separator) { - + $group = [ 'mysql' => 'GROUP_CONCAT', 'postgresql' => 'string_agg', ]; - + $name = $this->persistence->getPlatForm()->getName(); return $group[$name] . '(' . $variable . ',' . $this->escape($this->quote($separator)) . ')'; } diff --git a/core/kernel/persistence/smoothsql/search/exception/InvalidValueException.php b/core/kernel/persistence/smoothsql/search/exception/InvalidValueException.php index bf2f9b5c9..c4f121134 100644 --- a/core/kernel/persistence/smoothsql/search/exception/InvalidValueException.php +++ b/core/kernel/persistence/smoothsql/search/exception/InvalidValueException.php @@ -15,7 +15,6 @@ */ class InvalidValueException extends \InvalidArgumentException implements \common_exception_UserReadableException { - /** * Get the human-readable message for the end-user. It is supposed * to be translated and does not contain any confidential information diff --git a/core/kernel/persistence/wrapper/RdfWrapper.php b/core/kernel/persistence/wrapper/RdfWrapper.php index 16df4e053..c6e2a04dd 100644 --- a/core/kernel/persistence/wrapper/RdfWrapper.php +++ b/core/kernel/persistence/wrapper/RdfWrapper.php @@ -37,12 +37,12 @@ class RdfWrapper implements \oat\generis\model\data\RdfInterface * @var RdfsInterface */ private $rdfsInterface; - + public function __construct(RdfsInterface $rdfsInterface) { $this->rdfsInterface = $rdfsInterface; } - + /** * (non-PHPdoc) * @see \oat\generis\model\data\RdfInterface::get() @@ -51,7 +51,7 @@ public function get($subject, $predicate) { throw new \common_Exception('Not implemented'); } - + /** * (non-PHPdoc) * @see \oat\generis\model\data\RdfInterface::add() @@ -64,25 +64,25 @@ public function add(\core_kernel_classes_Triple $triple) $class = new \core_kernel_classes_Class($triple->object); return $this->rdfsInterface->getResourceImplementation()->setType($resource, $class); break; - + case OntologyRdfs::RDFS_RANGE: $resource = new \core_kernel_classes_Property($triple->subject); $class = new \core_kernel_classes_Class($triple->object); return $this->rdfsInterface->getPropertyImplementation()->setRange($resource, $class); break; - + case GenerisRdf::PROPERTY_MULTIPLE: $resource = new \core_kernel_classes_Property($triple->subject); $value = $triple->object == GenerisRdf::GENERIS_TRUE; return $this->rdfsInterface->getPropertyImplementation()->setMultiple($resource, $value); break; - + case GenerisRdf::PROPERTY_IS_LG_DEPENDENT: $resource = new \core_kernel_classes_Property($triple->subject); $value = $triple->object == GenerisRdf::GENERIS_TRUE; return $this->rdfsInterface->getPropertyImplementation()->setLgDependent($resource, $value); break; - + case OntologyRdfs::RDFS_DOMAIN: default: $resource = new \core_kernel_classes_Resource($triple->subject); @@ -94,7 +94,7 @@ public function add(\core_kernel_classes_Triple $triple) } } } - + /** * (non-PHPdoc) * @see \oat\generis\model\data\RdfInterface::remove() @@ -112,7 +112,7 @@ public function search($predicate, $object) { throw new \common_Exception('Not implemented'); } - + public function getIterator() { throw new \common_Exception('Not implemented'); diff --git a/core/kernel/rules/class.Expression.php b/core/kernel/rules/class.Expression.php index 5cc7a6604..37c986ba9 100644 --- a/core/kernel/rules/class.Expression.php +++ b/core/kernel/rules/class.Expression.php @@ -22,7 +22,7 @@ */ use oat\generis\model\RulesRdf; - + /** * Short description of class core_kernel_rules_Expression * @@ -97,7 +97,7 @@ public function evaluate($variable = []) */ public function __construct($uri, $debug = '') { - + parent::__construct($uri); } @@ -115,7 +115,7 @@ public function getLogicalOperator() $property = new core_kernel_classes_Property(RulesRdf::PROPERTY_HASLOGICALOPERATOR); $this->logicalOperator = $this->getUniquePropertyValue($property); } - $returnValue = $this->logicalOperator; + $returnValue = $this->logicalOperator; return $returnValue; } @@ -137,7 +137,7 @@ public function getTerminalExpression() } else { throw new common_Exception('property retrieve should be a Resource'); } - + return $returnValue; } @@ -188,13 +188,13 @@ public function getSecondExpression() */ public function expEval($variable = []) { - + $terminalExpression = $this->getTerminalExpression(); - + if ($terminalExpression->getUri() == RulesRdf::INSTANCE_EMPTY_TERM_URI) { $firstPart = $this->getFirstExpression()->expEval($variable) ; - + if ($this->getLogicalOperator()->getUri() == RulesRdf::INSTANCE_AND_OPERATOR) { if ($firstPart == false) { common_Logger::i('CUT : first Expression == FALSE and OPERATOR = AND', ['Generis Expression']); @@ -217,7 +217,7 @@ public function expEval($variable = []) common_Logger::d('Both Part are Container', ['Generis Expression']); $returnValue = $this->operatorEval($firstPart, $secondPart); } - + //both are vector elseif ( $firstPart instanceof core_kernel_classes_ContainerCollection @@ -231,33 +231,33 @@ public function expEval($variable = []) //analyse right collection and remove any container in it which is not literal if (!($subRightPart instanceof core_kernel_classes_Resource)) { //print_r($subLeftPart);print_r($subRightPart); - + $returnValue = $returnValue || $this->operatorEval($subLeftPart, $subRightPart); } } } } - //die("the evaluation is ". $returnValue); - - //throw new common_Exception('not implemented yet', __FILE__,__LINE__); + //die("the evaluation is ". $returnValue); + + //throw new common_Exception('not implemented yet', __FILE__,__LINE__); } // first is a vector second is a value elseif ( ($firstPart instanceof core_kernel_classes_ContainerCollection) - && ($secondPart instanceof core_kernel_classes_Container ) + && ($secondPart instanceof core_kernel_classes_Container) ) { $tempResult = false; foreach ($firstPart->getIterator() as $container) { common_Logger::d('FirstPart Part is ContainerCollection Second is Container', ['Generis Expression']); //TODO For now consider that if only one value of the table return true, - + //TODO exist unique need to be added - + if ($this->getLogicalOperator()->getUri() != RulesRdf::INSTANCE_DIFFERENT_OPERATOR_URI) { $tempResult = $tempResult || $this->operatorEval($container, $secondPart); } else { if ($this->operatorEval($container, $secondPart)) { - $tempResult = true; + $tempResult = true; } else { break; $tempResult = false; @@ -269,11 +269,11 @@ public function expEval($variable = []) // first is a value second is a vector elseif ( ($firstPart instanceof core_kernel_classes_Container) - && ($secondPart instanceof core_kernel_classes_ContainerCollection ) + && ($secondPart instanceof core_kernel_classes_ContainerCollection) ) { foreach ($secondPart->getIterator() as $container) { common_Logger::d('FirstPart Part Container is Second is ContainerCollection', ['Generis Expression']); - + //TODO For now consider that all value of the table need to be equal to return true, , //TODO exist unique need to be added $tempResult = $tempResult && $this->operatorEval($firstPart, $container); @@ -283,24 +283,22 @@ public function expEval($variable = []) //case we compare boolean else { common_Logger::d('Both part are boolean', ['Generis Expression']); - + switch ($this->getLogicalOperator()->getUri()) { - case RulesRdf::INSTANCE_OR_OPERATOR : { + case RulesRdf::INSTANCE_OR_OPERATOR: $returnValue = $firstPart || $secondPart ; - + break; - - } - case RulesRdf::INSTANCE_AND_OPERATOR : { + + + case RulesRdf::INSTANCE_AND_OPERATOR: $returnValue = $firstPart && $secondPart ; break; - - } - default : { + + + default: var_dump($this); throw new common_Exception('Expression ' . $this->getLabel() . ' do not have knowm operator'); - - } } } } else { @@ -330,7 +328,7 @@ public function evalEquals(core_kernel_classes_Literal $first, core_kernel_class if ($first instanceof core_kernel_classes_Literal && $second instanceof core_kernel_classes_Literal) { $returnValue = $first->literal == $second->literal; } - + return (bool) $returnValue; } @@ -350,7 +348,7 @@ public function evalDifferent(core_kernel_classes_Literal $first, core_kernel_cl if ($first instanceof core_kernel_classes_Literal && $second instanceof core_kernel_classes_Literal) { $returnValue = $first->literal != $second->literal; } - + return (bool) $returnValue; } @@ -370,8 +368,8 @@ public function evalInfEquals(core_kernel_classes_Literal $first, core_kernel_cl if ($first instanceof core_kernel_classes_Literal && $second instanceof core_kernel_classes_Literal) { $returnValue = $first->literal <= $second->literal; } - - + + return (bool) $returnValue; } @@ -391,7 +389,7 @@ public function evalInf(core_kernel_classes_Literal $first, core_kernel_classes_ if ($first instanceof core_kernel_classes_Literal && $second instanceof core_kernel_classes_Literal) { $returnValue = $first->literal < $second->literal; } - + return (bool) $returnValue; } @@ -411,7 +409,7 @@ public function evalSup(core_kernel_classes_Literal $first, core_kernel_classes_ if ($first instanceof core_kernel_classes_Literal && $second instanceof core_kernel_classes_Literal) { $returnValue = $first->literal > $second->literal; } - + return (bool) $returnValue; } @@ -431,7 +429,7 @@ public function evalSupEquals(core_kernel_classes_Literal $first, core_kernel_cl if ($first instanceof core_kernel_classes_Literal && $second instanceof core_kernel_classes_Literal) { $returnValue = $first->literal >= $second->literal; } - + return (bool) $returnValue; } @@ -458,45 +456,43 @@ public function operatorEval(core_kernel_classes_Container $firstPart, core_kern common_Logger::d('Second Value : ' . $secondPart->literal, ['Generis Expression']); common_Logger::d('Operator : ' . $this->getLogicalOperator()->getLabel(), ['Generis Expression']); switch ($this->getLogicalOperator()->getUri()) { - case RulesRdf::INSTANCE_EQUALS_OPERATOR_URI : { + case RulesRdf::INSTANCE_EQUALS_OPERATOR_URI: $returnValue = $this->evalEquals($firstPart, $secondPart); break; - - } - case RulesRdf::INSTANCE_DIFFERENT_OPERATOR_URI : { + + + case RulesRdf::INSTANCE_DIFFERENT_OPERATOR_URI: $returnValue = $this->evalDifferent($firstPart, $secondPart); break; - - } - case RulesRdf::INSTANCE_SUP_EQ_OPERATOR_URI : { + + + case RulesRdf::INSTANCE_SUP_EQ_OPERATOR_URI: $returnValue = $this->evalSupEquals($firstPart, $secondPart); break; - - } - case RulesRdf::INSTANCE_INF_EQ_OPERATOR_URI : { + + + case RulesRdf::INSTANCE_INF_EQ_OPERATOR_URI: $returnValue = $this->evalInfEquals($firstPart, $secondPart); break; - - } - case RulesRdf::INSTANCE_SUP_OPERATOR_URI : { + + + case RulesRdf::INSTANCE_SUP_OPERATOR_URI: $returnValue = $this->evalSup($firstPart, $secondPart); break; - - } - case RulesRdf::INSTANCE_INF_OPERATOR_URI : { + + + case RulesRdf::INSTANCE_INF_OPERATOR_URI: $returnValue = $this->evalInf($firstPart, $secondPart); break; - - } - - default: { + + + + default: var_dump($this); throw new common_Exception('Expression ' . $this->getLabel() . ' do not have knowm operator'); - - } } - + $logValue = $returnValue ? ' TRUE ' : ' FALSE '; common_Logger::d('Expression Value : ' . $logValue, ['Generis Expression']); return (bool) $returnValue; diff --git a/core/kernel/rules/class.ExpressionFactory.php b/core/kernel/rules/class.ExpressionFactory.php index d46992678..714b9d83f 100644 --- a/core/kernel/rules/class.ExpressionFactory.php +++ b/core/kernel/rules/class.ExpressionFactory.php @@ -22,7 +22,7 @@ */ use oat\generis\model\RulesRdf; - + /** * Short description of class core_kernel_rules_ExpressionFactory * @@ -98,7 +98,7 @@ public static function createRecursiveExpression(core_kernel_rules_Expression $e $returnValue->setPropertyValue($firstExpressionProperty, $exp1->getUri()); $returnValue->setPropertyValue($secondExpressionProperty, $exp2->getUri()); $returnValue->setPropertyValue($logicalOperatorProperty, $operator->getUri()); - + return $returnValue; } diff --git a/core/kernel/rules/class.Operation.php b/core/kernel/rules/class.Operation.php index 2dd23b210..47fdd9531 100644 --- a/core/kernel/rules/class.Operation.php +++ b/core/kernel/rules/class.Operation.php @@ -20,9 +20,9 @@ * 2017 (update and modification) Open Assessment Technologies SA (under the project TAO-PRODUCT) * */ - + use oat\generis\model\RulesRdf; - + /** * Short description of class core_kernel_rules_Operation * @@ -127,7 +127,7 @@ public function getOperator() */ public function evaluate($variable = []) { - + common_Logger::i('Evaluating Operation uri : ' . $this->getUri(), ['Generis Operation']); common_Logger::i('Evaluating Operation name : ' . $this->getLabel(), ['Generis Operation']); $operator = $this->getOperator(); @@ -152,7 +152,7 @@ public function evaluate($variable = []) } - + if ($secondPart instanceof core_kernel_classes_ContainerCollection) { //if we have more than one result we only take the resource label $nbLiteral = 0; @@ -173,7 +173,7 @@ public function evaluate($variable = []) common_Logger::d('Second Part : ' . $secondPart, ['Generis Operation']); $returnValue = $this->evaluateRecursiveOperation($firstPart, $secondPart, $operator); common_Logger::i('Operation value: ' . $returnValue, ['Generis Operation']); - + return $returnValue; } @@ -189,42 +189,40 @@ public function evaluate($variable = []) */ public function evaluateRecursiveOperation(core_kernel_classes_Literal $first, core_kernel_classes_Literal $second, core_kernel_classes_Resource $operator) { - - + + switch ($operator->getUri()) { - case RulesRdf::INSTANCE_OPERATOR_ADD: { + case RulesRdf::INSTANCE_OPERATOR_ADD: $returnValue = new core_kernel_classes_Literal($first->literal + $second->literal); break; - - } - case RulesRdf::INSTANCE_OPERATOR_MINUS: { + + + case RulesRdf::INSTANCE_OPERATOR_MINUS: $returnValue = new core_kernel_classes_Literal($first->literal - $second->literal); break; - - } - case RulesRdf::INSTANCE_OPERATOR_MULTIPLY: { + + + case RulesRdf::INSTANCE_OPERATOR_MULTIPLY: $returnValue = new core_kernel_classes_Literal($first->literal * $second->literal); break; - - } - case RulesRdf::INSTANCE_OPERATOR_DIVISION: { + + + case RulesRdf::INSTANCE_OPERATOR_DIVISION: $returnValue = new core_kernel_classes_Literal($first->literal / $second->literal); break; - - } - case RulesRdf::INSTANCE_OPERATOR_CONCAT: { + + + case RulesRdf::INSTANCE_OPERATOR_CONCAT: // FIXME Hotfix for the concat operator. Can't find why traling spaces are not // kept intact when using concat. // ex: 'february ' CONCAT '2008' -> 'february2008' instead of 'february 2008'. $returnValue = new core_kernel_classes_Literal($first->literal . ' ' . $second->literal); break; - - } - - default : { + + + + default: throw new common_Exception('problem evaluating operation, operator do not match with operands'); - - } } $returnValue->debug = __METHOD__; return $returnValue; diff --git a/core/kernel/rules/class.OperationFactory.php b/core/kernel/rules/class.OperationFactory.php index bbe6b56b2..95c924ccf 100644 --- a/core/kernel/rules/class.OperationFactory.php +++ b/core/kernel/rules/class.OperationFactory.php @@ -23,7 +23,7 @@ */ use oat\generis\model\RulesRdf; - + /** * Short description of class core_kernel_rules_OperationFactory * diff --git a/core/kernel/rules/class.Rule.php b/core/kernel/rules/class.Rule.php index 2eaa2bd86..e972a9875 100644 --- a/core/kernel/rules/class.Rule.php +++ b/core/kernel/rules/class.Rule.php @@ -19,9 +19,9 @@ * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); * 2017 (update and modification) Open Assessment Technologies SA (under the project TAO-PRODUCT); */ - + use oat\generis\model\RulesRdf; - + /** * Short description of class core_kernel_rules_Rule * diff --git a/core/kernel/rules/class.Term.php b/core/kernel/rules/class.Term.php index 50d47919c..410ba8e63 100644 --- a/core/kernel/rules/class.Term.php +++ b/core/kernel/rules/class.Term.php @@ -19,10 +19,10 @@ * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); * 2017 (update and modification) Open Assessment Technologies SA (under the project TAO-PRODUCT); */ - + use oat\generis\model\OntologyRdf; use oat\generis\model\RulesRdf; - + /** * Short description of class core_kernel_rules_Term * @@ -50,47 +50,47 @@ class core_kernel_rules_Term extends core_kernel_classes_Resource */ public function evaluate($variable = []) { - + common_Logger::i('Evaluating Term uri : ' . $this->getUri(), ['Generis Term']); common_Logger::i('Evaluating Term name : ' . $this->getLabel(), ['Generis Term']); $termType = $this->getUniquePropertyValue(new core_kernel_classes_Property(OntologyRdf::RDF_TYPE)); common_Logger::d('Term s type : ' . $termType->getUri(), ['Generis Term']); switch ($termType->getUri()) { - case RulesRdf::CLASS_TERM : { + case RulesRdf::CLASS_TERM: throw new common_Exception("Forbidden Type of Term"); - + break; - - } - case RulesRdf::CLASS_TERM_SUJET_PREDICATE_X : { - $returnValue = $this->evaluateSPX($variable); + + + case RulesRdf::CLASS_TERM_SUJET_PREDICATE_X: + $returnValue = $this->evaluateSPX($variable); break; - - } - case RulesRdf::CLASS_URI_TERM_X_PREDICATE_OBJECT : { - $returnValue = $this->evaluateXPO(); + + + case RulesRdf::CLASS_URI_TERM_X_PREDICATE_OBJECT: + $returnValue = $this->evaluateXPO(); break; - - } - case RulesRdf::CLASS_URI_CONSTRUCTED_SET : { - $returnValue = $this->evaluateSet(); + + + case RulesRdf::CLASS_URI_CONSTRUCTED_SET: + $returnValue = $this->evaluateSet(); break; - - } - case RulesRdf::CLASS_TERM_CONST : { - $returnValue = $this->evaluateConst(); + + + case RulesRdf::CLASS_TERM_CONST: + $returnValue = $this->evaluateConst(); break; - - } - case RulesRdf::CLASS_OPERATION : { - $returnValue = $this->evaluateOperation($variable); + + + case RulesRdf::CLASS_OPERATION: + $returnValue = $this->evaluateOperation($variable); break; - - } + + default: throw new common_Exception('problem evaluating Term'); } - + return $returnValue; } @@ -115,7 +115,7 @@ public function evalutateSetOperation(core_kernel_classes_Resource $setOperator, } else { throw new common_Exception('unknow set operator'); } - + return $returnValue; } @@ -130,7 +130,7 @@ public function evalutateSetOperation(core_kernel_classes_Resource $setOperator, */ protected function evaluateSPX($variable = []) { - + common_Logger::d('SPX TYPE', ['Generis Term evaluateSPX']); $resource = $this->getUniquePropertyValue(new core_kernel_classes_Property(RulesRdf::PROPERTY_TERM_SPX_SUBJET)); if ($resource instanceof core_kernel_classes_Resource) { @@ -141,7 +141,7 @@ protected function evaluateSPX($variable = []) common_Logger::d('Variable repaced uri : ' . $resource->getUri(), ['Generis Term evaluateSPX']); common_Logger::d('Variable repaced name : ' . $resource->getLabel(), ['Generis Term evaluateSPX']); } - + try { $propertyInstance = $this->getUniquePropertyValue(new core_kernel_classes_Property(RulesRdf::PROPERTY_TERM_SPX_PREDICATE)); } catch (common_Exception $e) { @@ -184,7 +184,7 @@ protected function evaluateSPX($variable = []) */ protected function evaluateXPO() { - + common_Logger::d('XPO TYPE', ['Generis Term evaluateXPO']); $classTerm = new core_kernel_classes_Class(RulesRdf::CLASS_URI_TERM_X_PREDICATE_OBJECT); $obj = $this->getUniquePropertyValue(new core_kernel_classes_Property(RulesRdf::PROPERTY_TERM_XPO_OBJECT)); @@ -195,7 +195,7 @@ protected function evaluateXPO() if ($obj instanceof core_kernel_classes_Resource) { $objValue = $pred->getUri(); } - + $returnValue = new core_kernel_classes_ContainerCollection(new common_Object(__METHOD__)); $terms = $classTerm->searchInstances([$pred->getUri() => $objValue], ['like' => false]); foreach ($terms as $term) { @@ -213,7 +213,7 @@ protected function evaluateXPO() */ protected function evaluateSet() { - + common_Logger::d('Constructed Set TYPE', ['Generis Term evaluateSet']); $operator = $this->getUniquePropertyValue(new core_kernel_classes_Property(RulesRdf::PROPERTY_SET_OPERATOR)); $subSets = $this->getPropertyValuesCollection(new core_kernel_classes_Property(RulesRdf::PROPERTY_SUBSET)); @@ -233,7 +233,7 @@ protected function evaluateSet() throw new common_Exception('Bad Type , waiting for a Resource '); } } - + return $returnValue; } @@ -246,7 +246,7 @@ protected function evaluateSet() */ protected function evaluateConst() { - + common_Logger::d('CONSTANTE TYPE', ['Generis Term evaluateConst']); $property = new core_kernel_classes_Property(RulesRdf::PROPERTY_TERM_VALUE); return $this->getUniquePropertyValue($property); @@ -262,7 +262,7 @@ protected function evaluateConst() */ protected function evaluateOperation($variable = []) { - + common_Logger::d('OPERATION TYPE', ['Generis Term evaluateOperation']); return $this->evaluateArithmOperation($variable); } @@ -277,7 +277,7 @@ protected function evaluateOperation($variable = []) */ public function evaluateArithmOperation($variable = []) { - + $operation = new core_kernel_rules_Operation($this->getUri(), __METHOD__); return $operation->evaluate($variable); } diff --git a/core/kernel/rules/class.TermFactory.php b/core/kernel/rules/class.TermFactory.php index 7190bf6f4..f92b7bcc5 100644 --- a/core/kernel/rules/class.TermFactory.php +++ b/core/kernel/rules/class.TermFactory.php @@ -19,9 +19,9 @@ * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); * 2017 (update and modification) Open Assessment Technologies SA (under the project TAO-PRODUCT); */ - + use oat\generis\model\RulesRdf; - + /** * Short description of class core_kernel_rules_TermFactory * @@ -82,7 +82,7 @@ public static function createSPX(core_kernel_classes_Resource $subject, core_ker $comment = 'Def Term SPX Label : ' . $subject->getUri() . ' ' . $predicate->getUri(); $SPXResource = core_kernel_classes_ResourceFactory::create($termSPXClass, $label, $comment); $returnValue = new core_kernel_rules_Term($SPXResource->getUri()); - + $subjectProperty = new core_kernel_classes_Property(RulesRdf::PROPERTY_TERM_SPX_SUBJET, __METHOD__); $predicateProperty = new core_kernel_classes_Property(RulesRdf::PROPERTY_TERM_SPX_PREDICATE, __METHOD__); $returnValue->setPropertyValue($subjectProperty, $subject->getUri()); diff --git a/core/kernel/uri/Bin2HexUriProvider.php b/core/kernel/uri/Bin2HexUriProvider.php index 5e4cd6e08..2a76d37c1 100644 --- a/core/kernel/uri/Bin2HexUriProvider.php +++ b/core/kernel/uri/Bin2HexUriProvider.php @@ -34,7 +34,7 @@ */ class Bin2HexUriProvider extends ConfigurableService implements UriProvider { - const OPTION_NAMESPACE = 'namespace'; + public const OPTION_NAMESPACE = 'namespace'; /** * Generates a URI based on a serial stored in the database. diff --git a/core/kernel/uri/MicrotimeRandUriProvider.php b/core/kernel/uri/MicrotimeRandUriProvider.php index ff31fab1e..5a9ed97a1 100644 --- a/core/kernel/uri/MicrotimeRandUriProvider.php +++ b/core/kernel/uri/MicrotimeRandUriProvider.php @@ -37,15 +37,15 @@ */ class MicrotimeRandUriProvider extends ConfigurableService implements UriProvider { - const OPTION_PERSISTENCE = 'persistence'; - - const OPTION_NAMESPACE = 'namespace'; + public const OPTION_PERSISTENCE = 'persistence'; + + public const OPTION_NAMESPACE = 'namespace'; // --- ASSOCIATIONS --- - + // --- ATTRIBUTES --- - + // --- OPERATIONS --- - + /** * @return common_persistence_SqlPersistence */ @@ -53,7 +53,7 @@ public function getPersistence() { return $this->getServiceLocator()->get(PersistenceManager::SERVICE_ID)->getPersistenceById($this->getOption(self::OPTION_PERSISTENCE)); } - + /** * Generates a URI based on the value of PHP microtime() and rand(). * @@ -63,7 +63,7 @@ public function getPersistence() */ public function provide() { - + $uriExist = false; do { list($usec, $sec) = explode(" ", microtime()); @@ -74,7 +74,7 @@ public function provide() $sqlResult->closeCursor(); } } while ($uriExist); - + return (string) $uri; } } diff --git a/core/kernel/uri/UriProvider.php b/core/kernel/uri/UriProvider.php index d0a57beeb..17b557d29 100644 --- a/core/kernel/uri/UriProvider.php +++ b/core/kernel/uri/UriProvider.php @@ -34,7 +34,7 @@ */ interface UriProvider { - const SERVICE_ID = 'generis/uriProvider'; + public const SERVICE_ID = 'generis/uriProvider'; /** * Provides a URI. diff --git a/core/kernel/uri/class.AdvKeyValueUriProvider.php b/core/kernel/uri/class.AdvKeyValueUriProvider.php index 0bb14e3a9..7880fc710 100755 --- a/core/kernel/uri/class.AdvKeyValueUriProvider.php +++ b/core/kernel/uri/class.AdvKeyValueUriProvider.php @@ -34,11 +34,11 @@ */ class core_kernel_uri_AdvKeyValueUriProvider extends ConfigurableService implements UriProvider { - const OPTION_PERSISTENCE = 'persistence'; - const OPTION_NAMESPACE = 'namespace'; - - const PERSISTENCE_KEY = 'generis_uriProvider'; - + public const OPTION_PERSISTENCE = 'persistence'; + public const OPTION_NAMESPACE = 'namespace'; + + public const PERSISTENCE_KEY = 'generis_uriProvider'; + /** * @return common_persistence_AdvKeyValuePersistence */ @@ -46,7 +46,7 @@ public function getPersistence() { return common_persistence_AdvKeyValuePersistence::getPersistence($this->getOption(self::OPTION_PERSISTENCE)); } - + /** * Generates a URI based on a serial stored in the database. * diff --git a/core/kernel/uri/class.DatabaseSerialUriProvider.php b/core/kernel/uri/class.DatabaseSerialUriProvider.php index c648162fc..ccc8c5396 100644 --- a/core/kernel/uri/class.DatabaseSerialUriProvider.php +++ b/core/kernel/uri/class.DatabaseSerialUriProvider.php @@ -34,15 +34,15 @@ */ class core_kernel_uri_DatabaseSerialUriProvider extends ConfigurableService implements UriProvider { - const OPTION_PERSISTENCE = 'persistence'; - - const OPTION_NAMESPACE = 'namespace'; + public const OPTION_PERSISTENCE = 'persistence'; + + public const OPTION_NAMESPACE = 'namespace'; // --- ASSOCIATIONS --- - + // --- ATTRIBUTES --- - + // --- OPERATIONS --- - + /** * @return common_persistence_SqlPersistence */ @@ -50,7 +50,7 @@ public function getPersistence() { return common_persistence_SqlPersistence::getPersistence($this->getOption(self::OPTION_PERSISTENCE)); } - + /** * Generates a URI based on a serial stored in the database. * @@ -66,10 +66,10 @@ public function provide() $sth = $this->getPersistence()->query($this->getPersistence()->getPlatForm()->getSqlFunction("generis_sequence_uri_provider"), [ $this->getOption(self::OPTION_NAMESPACE) ]); - + if ($sth !== false) { $row = $sth->fetch(); - + $returnValue = current($row); $sth->closeCursor(); } else { diff --git a/core/kernel/uri/class.UriService.php b/core/kernel/uri/class.UriService.php index 2eca6628a..e8f9e35fc 100644 --- a/core/kernel/uri/class.UriService.php +++ b/core/kernel/uri/class.UriService.php @@ -30,10 +30,10 @@ */ class core_kernel_uri_UriService { - const CONFIG_KEY = 'uriProvider'; - + public const CONFIG_KEY = 'uriProvider'; + private static $instance; - + public static function singleton() { if (is_null(self::$instance)) { @@ -41,9 +41,9 @@ public static function singleton() } return self::$instance; } - + private $uriProvider = null; - + /** * Generate a new URI with the UriProvider in force. * @@ -53,7 +53,7 @@ public function generateUri() { return (string) $this->getUriProvider()->provide(); } - + /** * Set the UriProvider in force. * @@ -64,7 +64,7 @@ public function setUriProvider(UriProvider $provider) $this->uriProvider = $provider; ServiceManager::getServiceManager()->register(UriProvider::SERVICE_ID, $provider); } - + /** * Get the UriProvider in force. * diff --git a/core/kernel/users/class.AuthAdapter.php b/core/kernel/users/class.AuthAdapter.php index 355d95e31..74cc71075 100755 --- a/core/kernel/users/class.AuthAdapter.php +++ b/core/kernel/users/class.AuthAdapter.php @@ -43,21 +43,21 @@ public static function getPasswordHash() { return core_kernel_users_Service::getPasswordHash(); } - + /** * Username to verify * * @var string */ private $username; - + /** * Password to verify * * @var $password */ private $password; - + /** * * @param unknown $login @@ -68,20 +68,20 @@ public function __construct($login, $password) $this->username = $login; $this->password = $password; } - + /** * (non-PHPdoc) * @see common_user_auth_Adapter::authenticate() */ public function authenticate() { - + $userClass = new core_kernel_classes_Class(GenerisRdf::CLASS_GENERIS_USER); $filters = [GenerisRdf::PROPERTY_USER_LOGIN => $this->username]; $options = ['like' => false, 'recursive' => true]; $users = $userClass->searchInstances($filters, $options); - - + + if (count($users) > 1) { // Multiple users matching throw new common_exception_InconsistentData("Multiple Users found with the same login '" . $this->username . "'."); @@ -96,13 +96,13 @@ public function authenticate() // should never happen, added for integrity throw new core_kernel_users_InvalidLoginException(); } - + $userResource = current($users); $hash = $userResource->getUniquePropertyValue(new core_kernel_classes_Property(GenerisRdf::PROPERTY_USER_PASSWORD)); if (!core_kernel_users_Service::getPasswordHash()->verify($this->password, $hash)) { throw new core_kernel_users_InvalidLoginException(); } - + return new core_kernel_users_GenerisUser($userResource); } } diff --git a/core/kernel/users/class.Cache.php b/core/kernel/users/class.Cache.php index d7f452d8c..978d9e8e7 100644 --- a/core/kernel/users/class.Cache.php +++ b/core/kernel/users/class.Cache.php @@ -45,7 +45,7 @@ class core_kernel_users_Cache * @access public * @var string */ - const SERIAL_PREFIX_INCLUDED_ROLES = 'roles-ir'; + public const SERIAL_PREFIX_INCLUDED_ROLES = 'roles-ir'; // --- OPERATIONS --- /** @@ -101,7 +101,7 @@ public static function cacheIncludedRoles(core_kernel_classes_Resource $role, $i foreach ($includedRoles as $resource) { $toCache[] = $resource->getUri(); } - + $serial = self::buildIncludedRolesSerial($role); /** @var SimpleCache $cache */ $cache = ServiceManager::getServiceManager()->get(SimpleCache::SERVICE_ID); @@ -114,7 +114,7 @@ public static function cacheIncludedRoles(core_kernel_classes_Resource $role, $i $msg .= $e->getMessage(); throw new core_kernel_users_CacheException($msg); } - + return (bool) $returnValue; } diff --git a/core/kernel/users/class.CacheException.php b/core/kernel/users/class.CacheException.php index 7acb8e713..63dab0ddd 100644 --- a/core/kernel/users/class.CacheException.php +++ b/core/kernel/users/class.CacheException.php @@ -1,4 +1,5 @@ $login], ['like' => false, 'recursive' => true] ); - + if (count($users) > 0) { $returnValue = true; } @@ -110,7 +109,7 @@ public function addUser($login, $password, core_kernel_classes_Resource $role = throw new core_kernel_users_Exception("Login '${login}' already in use.", core_kernel_users_Exception::LOGIN_EXITS); } else { $role = (empty($role)) ? new core_kernel_classes_Resource(GenerisRdf::INSTANCE_ROLE_GENERIS) : $role; - + $userClass = (!empty($class)) ? $class : new core_kernel_classes_Class(GenerisRdf::CLASS_GENERIS_USER); $returnValue = $userClass->createInstanceWithProperties([ OntologyRdfs::RDFS_LABEL => "User ${login}", @@ -119,7 +118,7 @@ public function addUser($login, $password, core_kernel_classes_Resource $role = GenerisRdf::PROPERTY_USER_PASSWORD => $this->userAdditionPasswordEncryption($login, $password), GenerisRdf::PROPERTY_USER_ROLES => $role ]); - + if (empty($returnValue)) { throw new core_kernel_users_Exception("Unable to create user with login = '${login}'."); } @@ -163,12 +162,12 @@ public function getOneUser($login, core_kernel_classes_Class $class = null) if (empty($class)) { $class = new core_kernel_classes_Class(GenerisRdf::CLASS_GENERIS_USER); } - + $users = $class->searchInstances( [GenerisRdf::PROPERTY_USER_LOGIN => $login], ['like' => false, 'recursive' => true] ); - + if (count($users) == 1) { $returnValue = current($users); } elseif (count($users) > 1) { @@ -207,7 +206,7 @@ public function isPasswordValid($password, core_kernel_classes_Resource $user) if (!is_string($password)) { throw new core_kernel_users_Exception('The password must be of "string" type, got ' . gettype($password)); } - + $hash = $user->getUniquePropertyValue(new core_kernel_classes_Property(GenerisRdf::PROPERTY_USER_PASSWORD)); $returnValue = core_kernel_users_Service::getPasswordHash()->verify($password, $hash); @@ -227,7 +226,7 @@ public function setPassword(core_kernel_classes_Resource $user, $password) if (!is_string($password)) { throw new core_kernel_users_Exception('The password must be of "string" type, got ' . gettype($password)); } - + $user->editPropertyValues(new core_kernel_classes_Property(GenerisRdf::PROPERTY_USER_PASSWORD), core_kernel_users_Service::getPasswordHash()->encrypt($password)); } @@ -245,14 +244,14 @@ public function getUserRoles(core_kernel_classes_Resource $user) // We use a Depth First Search approach to flatten the Roles Graph. $rolesProperty = new core_kernel_classes_Property(GenerisRdf::PROPERTY_USER_ROLES); $rootRoles = $user->getPropertyValuesCollection($rolesProperty); - + foreach ($rootRoles->getIterator() as $r) { $returnValue[$r->getUri()] = $r; $returnValue = array_merge($returnValue, $this->getIncludedRoles($r)); } - + $returnValue = array_unique($returnValue); - + return (array) $returnValue; } @@ -272,14 +271,14 @@ public function userHasRoles(core_kernel_classes_Resource $user, $roles) if (empty($roles)) { throw new InvalidArgumentException('The $roles parameter must not be empty.'); } - + $roles = (is_array($roles)) ? $roles : [$roles]; $searchRoles = []; foreach ($roles as $r) { $searchRoles[] = ($r instanceof core_kernel_classes_Resource) ? $r->getUri() : $r; } unset($roles); - + if (common_session_SessionManager::getSession()->getUserUri() == $user->getUri()) { foreach (common_session_SessionManager::getSession()->getUserRoles() as $role) { if (in_array($role, $searchRoles)) { @@ -292,10 +291,10 @@ public function userHasRoles(core_kernel_classes_Resource $user, $roles) common_Logger::w('Roles of non current user (' . $user->getUri() . ') checked, trying fallback to local ontology'); $userRoles = array_keys($this->getUserRoles($user)); $identicalRoles = array_intersect($searchRoles, $userRoles); - + $returnValue = (count($identicalRoles) === count($searchRoles)); } - + return (bool) $returnValue; } @@ -362,15 +361,15 @@ public function addRole($label, $includedRoles = null, core_kernel_classes_Class $includedRoles = is_array($includedRoles) ? $includedRoles : [$includedRoles]; $includedRoles = empty($includedRoles[0]) ? [] : $includedRoles; - + $classRole = (empty($class)) ? new core_kernel_classes_Class(GenerisRdf::CLASS_ROLE) : $class; $includesRoleProperty = new core_kernel_classes_Property(GenerisRdf::PROPERTY_ROLE_INCLUDESROLE); $role = $classRole->createInstance($label, "${label} Role"); - + foreach ($includedRoles as $ir) { $role->setPropertyValue($includesRoleProperty, $ir); } - + $returnValue = $role; return $returnValue; @@ -388,11 +387,11 @@ public function addRole($label, $includedRoles = null, core_kernel_classes_Class public function removeRole(core_kernel_classes_Resource $role) { $returnValue = (bool) false; - + if (GENERIS_CACHE_USERS_ROLES == true && core_kernel_users_Cache::areIncludedRolesInCache($role)) { if ($role->delete(true) == true) { // delete references. $returnValue = core_kernel_users_Cache::removeIncludedRoles($role); - + // We also need to remove all included roles cache that contain // the role we just deleted. foreach ($this->getAllRoles() as $r) { @@ -436,14 +435,14 @@ public function getIncludedRoles(core_kernel_classes_Resource $role) $visitedRoles = []; $s = []; // vertex stack. array_push($s, $role); // begin with $role as the first vertex. - + while (!empty($s)) { $u = array_pop($s); - + if (false === in_array($u->getUri(), $visitedRoles, true)) { $visitedRoles[] = $u->getUri(); $returnValue[$u->getUri()] = $u; - + $ar = $u->getPropertyValuesCollection($includesRoleProperty); foreach ($ar->getIterator() as $w) { if (false === in_array($w->getUri(), $visitedRoles, true)) { // not visited @@ -452,10 +451,10 @@ public function getIncludedRoles(core_kernel_classes_Resource $role) } } } - + // remove the root vertex which is actually the role we are testing. unset($returnValue[$role->getUri()]); - + if (GENERIS_CACHE_USERS_ROLES === true) { try { core_kernel_users_Cache::cacheIncludedRoles($role, $returnValue); @@ -519,17 +518,17 @@ public function getDefaultRole() public function includeRole(core_kernel_classes_Resource $role, core_kernel_classes_Resource $roleToInclude) { $includesRoleProperty = new core_kernel_classes_Property(GenerisRdf::PROPERTY_ROLE_INCLUDESROLE); - + // Clean to avoid double entries... $role->removePropertyValues($includesRoleProperty, ['like' => false, 'pattern' => $roleToInclude->getUri()]); - + // Include the Role. $role->setPropertyValue($includesRoleProperty, $roleToInclude->getUri()); - + // Reset cache. core_kernel_users_Cache::removeIncludedRoles($role); } - + /** * Uninclude a Role from antother Role. * @@ -546,12 +545,12 @@ public function unincludeRole(core_kernel_classes_Resource $role, core_kernel_cl // invalidate cache for the role. if (GENERIS_CACHE_USERS_ROLES == true) { core_kernel_users_Cache::removeIncludedRoles($role); - + // For each roles that have $role for included role, // remove the cache entry. foreach ($this->getAllRoles() as $r) { $includedRoles = $this->getIncludedRoles($r); - + if (array_key_exists($role->getUri(), $includedRoles)) { core_kernel_users_Cache::removeIncludedRoles($r); } @@ -627,7 +626,7 @@ public function getAllRoles() $roleClass = new core_kernel_classes_Class(GenerisRdf::CLASS_ROLE); return $roleClass->getInstances(true); } - + /** * Trigger user encrypition at user insertion time. * diff --git a/core/kernel/users/interface.RolesManagement.php b/core/kernel/users/interface.RolesManagement.php index 4e2807cc2..7d6fab435 100644 --- a/core/kernel/users/interface.RolesManagement.php +++ b/core/kernel/users/interface.RolesManagement.php @@ -1,4 +1,5 @@ getModel()->getSearchInterface(); } - + /** * * @param array $values @@ -69,16 +69,16 @@ protected function getSearchService() */ protected function searchResource(array $values) { - + $searchService = $this->getSearchService(); $gateWay = $searchService->getGateway(); - + $searchQueryBuilder = $gateWay->query(); - + $searchService->searchType($searchQueryBuilder, $this->getRootClass()->getUri(), true); - + $criterion = $searchQueryBuilder->newQuery(); - + foreach ($this->getUniquePredicates() as $field) { if (array_key_exists($field, $values)) { $value = $values[$field]; @@ -87,12 +87,12 @@ protected function searchResource(array $values) \common_Logger::i('Predicate ' . $field . ' is not found.'); } } - + $searchQueryBuilder->setCriteria($criterion)->setLimit(1); - + return $gateWay->search($searchQueryBuilder); } - + /** * return a new resource * @param array $values @@ -111,7 +111,7 @@ protected function createResource(array $values) */ public function hasResource(array $values) { - + $result = $this->searchResource($values); $count = $result->count(); @@ -123,7 +123,7 @@ public function hasResource(array $values) throw new DuplicateResourceException($this->getRootClass()->getUri(), $values); } } - + /** * * @param array $values @@ -132,7 +132,7 @@ public function hasResource(array $values) */ public function getResource(array $values) { - + $result = $this->searchResource($values); $count = $result->count(); diff --git a/core/resource/CreateOrReuseInterface.php b/core/resource/CreateOrReuseInterface.php index 53d882abf..9a9736869 100644 --- a/core/resource/CreateOrReuseInterface.php +++ b/core/resource/CreateOrReuseInterface.php @@ -32,7 +32,7 @@ interface CreateOrReuseInterface * @return \core_kernel_classes_Resource */ public function getResource(array $values); - + /** * return if resource exists * @param array $values diff --git a/core/resource/ResourceCollection.php b/core/resource/ResourceCollection.php index fd0891b76..a8f107965 100644 --- a/core/resource/ResourceCollection.php +++ b/core/resource/ResourceCollection.php @@ -39,7 +39,7 @@ class ResourceCollection implements Iterator, Countable use ServiceLocatorAwareTrait; use OntologyAwareTrait; - const CACHE_SIZE = 100; + public const CACHE_SIZE = 100; /** * @var string[] diff --git a/core/resource/exception/DuplicateResourceException.php b/core/resource/exception/DuplicateResourceException.php index b00956829..a1bcd35d4 100644 --- a/core/resource/exception/DuplicateResourceException.php +++ b/core/resource/exception/DuplicateResourceException.php @@ -26,15 +26,14 @@ */ class DuplicateResourceException extends \common_Exception { - public function __construct($type, array $values) { $message = 'Resource ' . $type . ' already duplicate for '; - + foreach ($values as $key => $value) { $message .= $key . ' = ' . $value . ' '; } - + parent::__construct($message); } } diff --git a/core/user/AuthAdapter.php b/core/user/AuthAdapter.php index a63a69362..3542fd954 100644 --- a/core/user/AuthAdapter.php +++ b/core/user/AuthAdapter.php @@ -42,8 +42,8 @@ */ class AuthAdapter extends Configurable implements LoginAdapter { - const OPTION_PATTERN = 'pattern'; - const OPTION_USERFACTORY = 'user_factory'; + public const OPTION_PATTERN = 'pattern'; + public const OPTION_USERFACTORY = 'user_factory'; /** * Returns the hashing algorithm defined in generis configuration @@ -56,21 +56,21 @@ public static function getPasswordHash() { return core_kernel_users_Service::getPasswordHash(); } - + /** * Username to verify * * @var string */ protected $username; - + /** * Password to verify * * @var $password */ protected $password; - + /** * (non-PHPdoc) * @see \oat\oatbox\user\auth\LoginAdapter::setCredentials() @@ -99,8 +99,8 @@ public function authenticate() $filters = [GenerisRdf::PROPERTY_USER_LOGIN => $this->username]; $options = ['like' => false, 'recursive' => true]; $users = $userClass->searchInstances($filters, $options); - - + + if (count($users) > 1) { // Multiple users matching throw new common_exception_InconsistentData("Multiple Users found with the same login '" . $this->username . "'."); @@ -115,7 +115,7 @@ public function authenticate() // should never happen, added for integrity throw new core_kernel_users_InvalidLoginException('Inexisting user did not fail password check, this should not happen'); } - + $userResource = current($users); $hash = $userResource->getUniquePropertyValue(new core_kernel_classes_Property(GenerisRdf::PROPERTY_USER_PASSWORD)); if (!core_kernel_users_Service::getPasswordHash()->verify($this->password, $hash)) { diff --git a/core/user/PasswordConstraintsException.php b/core/user/PasswordConstraintsException.php index 7dccfda87..6d5ab7540 100644 --- a/core/user/PasswordConstraintsException.php +++ b/core/user/PasswordConstraintsException.php @@ -23,5 +23,4 @@ class PasswordConstraintsException extends \common_exception_Error { - } diff --git a/core/user/PasswordConstraintsService.php b/core/user/PasswordConstraintsService.php index a3ff7576b..6ec85d03b 100644 --- a/core/user/PasswordConstraintsService.php +++ b/core/user/PasswordConstraintsService.php @@ -31,7 +31,7 @@ */ class PasswordConstraintsService { - static public function singleton() + public static function singleton() { return ServiceManager::getServiceManager()->get(\oat\tao\model\password\PasswordConstraintsService::SERVICE_ID); } diff --git a/core/user/UserFactoryServiceInterface.php b/core/user/UserFactoryServiceInterface.php index 70a9811d9..260eba73f 100644 --- a/core/user/UserFactoryServiceInterface.php +++ b/core/user/UserFactoryServiceInterface.php @@ -25,7 +25,7 @@ interface UserFactoryServiceInterface { - const SERVICE_ID = 'generis/userFactory'; + public const SERVICE_ID = 'generis/userFactory'; /** * @param core_kernel_classes_Resource $userResource * @param string $hashForEncryption diff --git a/helpers/SystemHelper.php b/helpers/SystemHelper.php index 73e6a18cd..871e85619 100644 --- a/helpers/SystemHelper.php +++ b/helpers/SystemHelper.php @@ -95,8 +95,10 @@ private static function toBytes($phpSyntax) switch ($last) { case 'g': $val *= 1024; + // no break case 'm': $val *= 1024; + // no break case 'k': $val *= 1024; } diff --git a/helpers/UuidPrimaryKeyTrait.php b/helpers/UuidPrimaryKeyTrait.php index 945bbd3c4..d550f67e4 100644 --- a/helpers/UuidPrimaryKeyTrait.php +++ b/helpers/UuidPrimaryKeyTrait.php @@ -1,4 +1,5 @@ " */ -declare(strict_types = 1); +declare(strict_types=1); namespace oat\generis\Helper; diff --git a/helpers/class.ExtensionHelper.php b/helpers/class.ExtensionHelper.php index 965c849ec..f89c95529 100755 --- a/helpers/class.ExtensionHelper.php +++ b/helpers/class.ExtensionHelper.php @@ -1,4 +1,5 @@ algorithm; } - + protected function getSaltLength() { return $this->saltLength; diff --git a/helpers/class.PhpTools.php b/helpers/class.PhpTools.php index 5f3f3d6b1..746a4fa14 100755 --- a/helpers/class.PhpTools.php +++ b/helpers/class.PhpTools.php @@ -1,4 +1,5 @@ add($triple); } - - + + foreach ($from as $triple) { $diff->remove($triple); } return $diff; } - + /** * @return Iterator */ @@ -41,7 +41,7 @@ public function getTriplesToAdd() { return new ArrayIterator($this->toAdd); } - + /** * @return Iterator */ @@ -49,7 +49,7 @@ public function getTriplesToRemove() { return new ArrayIterator($this->toRemove); } - + protected function add(core_kernel_classes_Triple $triple) { $serial = $this->generateSerial($triple); @@ -71,17 +71,17 @@ protected function remove(core_kernel_classes_Triple $triple) unset($this->toAdd[$serial]); } } - + protected function generateSerial(core_kernel_classes_Triple $triple) { return md5(implode(' ', [$triple->subject, $triple->predicate, $triple->object, $triple->lg, $triple->modelid])); } - + public function getSummary() { return count($this->toAdd) . ' triples to add and ' . count($this->toRemove) . ' triples to remove'; } - + public function dump() { foreach ($this->toAdd as $triple) { @@ -91,7 +91,7 @@ public function dump() echo '- ' . str_pad($triple->subject, 80) . ' ' . str_pad($triple->predicate, 80) . ' ' . str_pad($triple->object, 80) . PHP_EOL; } } - + public function applyTo(Model $model) { $rdf = $model->getRdfInterface(); diff --git a/helpers/class.Report.php b/helpers/class.Report.php index 99ed91202..448ca28cc 100644 --- a/helpers/class.Report.php +++ b/helpers/class.Report.php @@ -1,4 +1,5 @@ 0 ? str_repeat(' ', $intend) : '') . $report->getMessage() diff --git a/helpers/class.TimeOutHelper.php b/helpers/class.TimeOutHelper.php index 63af3bc7e..b33cfd441 100644 --- a/helpers/class.TimeOutHelper.php +++ b/helpers/class.TimeOutHelper.php @@ -1,4 +1,5 @@ markedTobeRemoved[] = $resource; + $this->markedTobeRemoved[] = $resource; } /** diff --git a/scripts/tools/FileSerializerMigration/Migrate.php b/scripts/tools/FileSerializerMigration/Migrate.php index 4d0758480..000844f38 100644 --- a/scripts/tools/FileSerializerMigration/Migrate.php +++ b/scripts/tools/FileSerializerMigration/Migrate.php @@ -38,7 +38,7 @@ */ class Migrate extends ScriptAction { - const MIGRATION_REPORT_LINES = [ + public const MIGRATION_REPORT_LINES = [ 'migration_success' => [ 'dry' => '%s old references will be migrated into %s new file serializer references.', 'wet' => 'Successfully migrated %s old references to %s new file serializer references.' diff --git a/scripts/tools/FileSerializerMigration/MigrationHelper.php b/scripts/tools/FileSerializerMigration/MigrationHelper.php index 7b74c0981..9d1b371a3 100644 --- a/scripts/tools/FileSerializerMigration/MigrationHelper.php +++ b/scripts/tools/FileSerializerMigration/MigrationHelper.php @@ -44,7 +44,7 @@ class MigrationHelper implements ServiceLocatorAwareInterface /** * Amount of resources processed in one batch */ - const BATCH_LIMIT = 100; + public const BATCH_LIMIT = 100; /** * @var UrlFileSerializer diff --git a/test/GenerisPhpUnitTestRunner.php b/test/GenerisPhpUnitTestRunner.php index 49215e747..370629766 100755 --- a/test/GenerisPhpUnitTestRunner.php +++ b/test/GenerisPhpUnitTestRunner.php @@ -19,14 +19,15 @@ * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); * */ + namespace oat\generis\test; -use \common_session_SessionManager; -use \common_test_TestUserSession; -use \common_ext_ExtensionsManager; -use \common_ext_ExtensionInstaller; -use \common_ext_ExtensionUninstaller; -use \common_persistence_Manager; +use common_session_SessionManager; +use common_test_TestUserSession; +use common_ext_ExtensionsManager; +use common_ext_ExtensionInstaller; +use common_ext_ExtensionUninstaller; +use common_persistence_Manager; use common_Config; /** diff --git a/test/KeyValueMockTrait.php b/test/KeyValueMockTrait.php index f742b8689..a499ffa3d 100644 --- a/test/KeyValueMockTrait.php +++ b/test/KeyValueMockTrait.php @@ -35,7 +35,7 @@ trait KeyValueMockTrait public function getKeyValueMock($key) { $driver = new \common_persistence_InMemoryKvDriver(); - $persistence = new \common_persistence_KeyValuePersistence([],$driver); + $persistence = new \common_persistence_KeyValuePersistence([], $driver); $pmProphecy = $this->prophesize(PersistenceManager::class); $pmProphecy->setServiceLocator(Argument::any())->willReturn(null); $pmProphecy->getPersistenceById($key)->willReturn($persistence); diff --git a/test/bootstrap.php b/test/bootstrap.php index 89d44891e..bda80fc12 100644 --- a/test/bootstrap.php +++ b/test/bootstrap.php @@ -1,4 +1,5 @@ assertFalse($property->removePropertyValues($domain, ['pattern' => OntologyRdfs::RDFS_LABEL])); diff --git a/test/integration/NamespaceTest.php b/test/integration/NamespaceTest.php index bffe63d45..1549e6b8c 100755 --- a/test/integration/NamespaceTest.php +++ b/test/integration/NamespaceTest.php @@ -33,7 +33,6 @@ class NamespaceTest extends TestCase { - public function setUp(): void { } diff --git a/test/integration/PropertyTest.php b/test/integration/PropertyTest.php index c62a480bf..1f77c9ca4 100755 --- a/test/integration/PropertyTest.php +++ b/test/integration/PropertyTest.php @@ -26,14 +26,13 @@ use oat\generis\model\OntologyRdf; use oat\generis\model\WidgetRdf; use oat\generis\test\GenerisPhpUnitTestRunner; -use \core_kernel_classes_ContainerCollection; -use \core_kernel_classes_Class; -use \core_kernel_classes_Resource; -use \core_kernel_classes_Property; +use core_kernel_classes_ContainerCollection; +use core_kernel_classes_Class; +use core_kernel_classes_Resource; +use core_kernel_classes_Property; class PropertyTest extends GenerisPhpUnitTestRunner { - /** * * @var core_kernel_classes_Property diff --git a/test/integration/ResourceTest.php b/test/integration/ResourceTest.php index 39e493beb..7c345e99f 100755 --- a/test/integration/ResourceTest.php +++ b/test/integration/ResourceTest.php @@ -27,18 +27,17 @@ use oat\generis\model\GenerisRdf; use oat\generis\model\OntologyRdfs; use oat\generis\test\GenerisPhpUnitTestRunner; -use \core_kernel_classes_Class; -use \core_kernel_classes_Resource; -use \core_kernel_classes_Property; -use \core_kernel_impl_ApiModelOO; -use \common_Utils; -use \core_kernel_classes_Literal; -use \common_Collection; -use \core_kernel_classes_Triple; +use core_kernel_classes_Class; +use core_kernel_classes_Resource; +use core_kernel_classes_Property; +use core_kernel_impl_ApiModelOO; +use common_Utils; +use core_kernel_classes_Literal; +use common_Collection; +use core_kernel_classes_Triple; class ResourceTest extends GenerisPhpUnitTestRunner { - protected $object; public function setUp(): void @@ -52,7 +51,7 @@ public function setUp(): void $this->clazz = $clazz->createSubClass($clazz); } - function tearDown(): void + public function tearDown(): void { $this->clazz->delete(); } @@ -304,11 +303,11 @@ public function testSetPropertiesValues() $instance = $class->createInstance('a label', 'a comment'); $this->assertIsA($instance, 'core_kernel_classes_Resource'); - $instance->setPropertiesValues([ - OntologyRdfs::RDFS_SEEALSO => "&plop n'\"; plop'\' plop", - OntologyRdfs::RDFS_LABEL => ['new label', 'another label', 'yet a last one'], - OntologyRdfs::RDFS_COMMENT => 'new comment' - ]); + $instance->setPropertiesValues([ + OntologyRdfs::RDFS_SEEALSO => "&plop n'\"; plop'\' plop", + OntologyRdfs::RDFS_LABEL => ['new label', 'another label', 'yet a last one'], + OntologyRdfs::RDFS_COMMENT => 'new comment' + ]); $seeAlso = $instance->getOnePropertyValue(new core_kernel_classes_Property(OntologyRdfs::RDFS_SEEALSO)); $this->assertNotNull($seeAlso); diff --git a/test/integration/SqlInjectionTest.php b/test/integration/SqlInjectionTest.php index 0c09b9191..40e834530 100644 --- a/test/integration/SqlInjectionTest.php +++ b/test/integration/SqlInjectionTest.php @@ -27,7 +27,6 @@ class SqlInjectionTestCase extends GenerisPhpUnitTestRunner { - public function testInject() { $generisClass = new core_kernel_classes_Class(GenerisRdf::CLASS_GENERIS_RESOURCE); diff --git a/test/integration/UserServiceTest.php b/test/integration/UserServiceTest.php index 20f326ee0..31bfe5065 100755 --- a/test/integration/UserServiceTest.php +++ b/test/integration/UserServiceTest.php @@ -25,8 +25,7 @@ class UserServiceTestCase extends GenerisPhpUnitTestRunner { - - const TESTCASE_USER_LOGIN = 'testcase_user'; + public const TESTCASE_USER_LOGIN = 'testcase_user'; /** * diff --git a/test/integration/common/cache/CacheTest.php b/test/integration/common/cache/CacheTest.php index 05ce14b68..cab05d61a 100644 --- a/test/integration/common/cache/CacheTest.php +++ b/test/integration/common/cache/CacheTest.php @@ -24,13 +24,12 @@ use common_cache_NotFoundException; use oat\generis\test\GenerisPhpUnitTestRunner; -use \common_cache_FileCache; +use common_cache_FileCache; // @todo can be turned into unit test, the problem is only constructing the cache object class CacheTest extends GenerisPhpUnitTestRunner { - /** * @dataProvider keyProvider */ diff --git a/test/integration/common/filesystem/DirectoryFilesystemTest.php b/test/integration/common/filesystem/DirectoryFilesystemTest.php index e5f519ddd..09b70d49e 100644 --- a/test/integration/common/filesystem/DirectoryFilesystemTest.php +++ b/test/integration/common/filesystem/DirectoryFilesystemTest.php @@ -134,5 +134,4 @@ private function getMockFileSystem() return $this->fileSystemService; } - } diff --git a/test/integration/common/persistence/PhpFilePersistenceTest.php b/test/integration/common/persistence/PhpFilePersistenceTest.php index 465982e4f..6e07c4262 100644 --- a/test/integration/common/persistence/PhpFilePersistenceTest.php +++ b/test/integration/common/persistence/PhpFilePersistenceTest.php @@ -24,8 +24,8 @@ use common_exception_NotImplemented; use oat\generis\test\GenerisPhpUnitTestRunner; -use \common_persistence_Persistence; -use \common_persistence_PhpFileDriver; +use common_persistence_Persistence; +use common_persistence_PhpFileDriver; use org\bovigo\vfs\vfsStream; class PhpFilePersistenceTest extends GenerisPhpUnitTestRunner diff --git a/test/integration/core/kernel/classes/ResourceIteratorTest.php b/test/integration/core/kernel/classes/ResourceIteratorTest.php index e07d0af27..89573769b 100644 --- a/test/integration/core/kernel/classes/ResourceIteratorTest.php +++ b/test/integration/core/kernel/classes/ResourceIteratorTest.php @@ -31,7 +31,6 @@ */ class ResourceIteratorTest extends TaoPhpUnitTestRunner { - protected static $sampleClass = 'http://www.tao.lu/Ontologies/TAO.rdf#ResourceIteratorTest'; public function tearDown(): void diff --git a/test/integration/helpers/FileSerializerMigrationHelperTest.php b/test/integration/helpers/FileSerializerMigrationHelperTest.php index b2616436a..c35711e26 100644 --- a/test/integration/helpers/FileSerializerMigrationHelperTest.php +++ b/test/integration/helpers/FileSerializerMigrationHelperTest.php @@ -41,9 +41,9 @@ class FileSerializerMigrationHelperTest extends GenerisTestCase { use FileSystemMockTrait; - const PARENT_RESOURCE_URI = 'http://www.tao.lu/Ontologies/generis.rdf#UnitTest'; - const PROPERTY_URI = 'http://www.tao.lu/Ontologies/generis.rdf#TestFile'; - const SAMPLE_FILE = 'fileMigrationUnitTest.txt'; + public const PARENT_RESOURCE_URI = 'http://www.tao.lu/Ontologies/generis.rdf#UnitTest'; + public const PROPERTY_URI = 'http://www.tao.lu/Ontologies/generis.rdf#TestFile'; + public const SAMPLE_FILE = 'fileMigrationUnitTest.txt'; /** * @var MigrationHelper diff --git a/test/integration/model/persistence/file/FileModelTest.php b/test/integration/model/persistence/file/FileModelTest.php index beb3373f5..b80c35cbd 100644 --- a/test/integration/model/persistence/file/FileModelTest.php +++ b/test/integration/model/persistence/file/FileModelTest.php @@ -22,12 +22,11 @@ namespace oat\generis\test\integration\model\kernel\persistence\file; use oat\generis\model\kernel\persistence\file\FileModel; -use \common_exception_MissingParameter; +use common_exception_MissingParameter; use oat\generis\test\GenerisPhpUnitTestRunner; class FileModelTest extends GenerisPhpUnitTestRunner { - /** * * @see PHPUnit_Framework_TestCase::setUp() diff --git a/test/integration/model/persistence/smoothsql/SmoothModelTest.php b/test/integration/model/persistence/smoothsql/SmoothModelTest.php index ddb9204da..8bfaa9e66 100644 --- a/test/integration/model/persistence/smoothsql/SmoothModelTest.php +++ b/test/integration/model/persistence/smoothsql/SmoothModelTest.php @@ -21,12 +21,11 @@ namespace oat\generis\test\integration\model\persistence\smoothsql; -use \core_kernel_persistence_smoothsql_SmoothModel; +use core_kernel_persistence_smoothsql_SmoothModel; use oat\generis\test\GenerisPhpUnitTestRunner; class SmoothModelTest extends GenerisPhpUnitTestRunner { - /** * * @see PHPUnit_Framework_TestCase::setUp() diff --git a/test/integration/model/persistence/smoothsql/SmoothsqlUtilsTest.php b/test/integration/model/persistence/smoothsql/SmoothsqlUtilsTest.php index be2663a0f..63a20e61f 100644 --- a/test/integration/model/persistence/smoothsql/SmoothsqlUtilsTest.php +++ b/test/integration/model/persistence/smoothsql/SmoothsqlUtilsTest.php @@ -24,14 +24,13 @@ namespace oat\generis\test\integration\model\persistence\smoothsql; use oat\generis\test\GenerisPhpUnitTestRunner; -use \core_kernel_classes_Resource; -use \core_kernel_classes_Literal; -use \core_kernel_persistence_smoothsql_Utils; +use core_kernel_classes_Resource; +use core_kernel_classes_Literal; +use core_kernel_persistence_smoothsql_Utils; use oat\generis\model\data\ModelManager; class SmootsqlUtilsTest extends GenerisPhpUnitTestRunner { - /** * SmootsqlUtilsTest constructor. * @param null $name @@ -59,7 +58,7 @@ public function testBuildSearchPattern($pattern, $like, $expected) { $this->assertSame($expected, core_kernel_persistence_smoothsql_Utils::buildSearchPattern($this->getModel()->getPersistence(), $pattern, $like)); } - + public function buildSearchPatternProvider() { return [ @@ -79,7 +78,7 @@ public function buildSearchPatternProvider() [new core_kernel_classes_Resource('http://www.13.com/ontology#toto'), true, '= ' . $this->quote('http://www.13.com/ontology#toto')], ]; } - + /** * @dataProvider buildPropertyQueryProvider * @@ -95,7 +94,7 @@ public function testBuildPropertyQuery($expected, $propertyUri, $values, $like, $this->assertSame($expected, $queryWithoutModelRestrictions); $this->assertSame(' AND modelid IN (', substr($query, strlen($expected), strlen(' AND modelid IN ('))); } - + public function buildPropertyQueryProvider() { return [ @@ -126,7 +125,7 @@ public function buildPropertyQueryProvider() ], ]; } - + /** * @dataProvider buildUnionQueryProvider * @@ -137,7 +136,7 @@ public function testBuildUnionQuery(array $queries, $expected) { $this->assertSame($expected, core_kernel_persistence_smoothsql_Utils::buildUnionQuery($queries)); } - + public function buildUnionQueryProvider() { return [ @@ -157,7 +156,7 @@ public function buildUnionQueryProvider() [[], false] ]; } - + public function buildFilterQueryProvider() { return [ @@ -187,7 +186,7 @@ public function buildFilterQueryProvider() ] ]; } - + /** * @return \core_kernel_persistence_smoothsql_SmoothModel */ @@ -195,7 +194,7 @@ private function getModel() { return ModelManager::getModel(); } - + /** * @param string $string * @return string diff --git a/test/integration/mutex/LockServiceTest.php b/test/integration/mutex/LockServiceTest.php index e1e1d12a0..995924d58 100644 --- a/test/integration/mutex/LockServiceTest.php +++ b/test/integration/mutex/LockServiceTest.php @@ -34,7 +34,6 @@ */ class LockServiceTest extends TestCase { - public function testLock() { $service = $this->getInstance(); diff --git a/test/integration/rules/ExpressionFactoryTest.php b/test/integration/rules/ExpressionFactoryTest.php index f486bf433..c5bcfe7d9 100644 --- a/test/integration/rules/ExpressionFactoryTest.php +++ b/test/integration/rules/ExpressionFactoryTest.php @@ -1,4 +1,5 @@ getName(), $oldIniValue); } - function testPHPRuntime() + public function testPHPRuntime() { // Core tests. $php = new \common_configuration_PHPRuntime('5.3', '5.4'); @@ -132,7 +132,7 @@ function testPHPRuntime() $this->assertEquals($php->getMax(), '5.3.99999'); } - function testPHPExtension() + public function testPHPExtension() { // Testing PHPExtension existence and version is quite hard to do. Indeed, // it depends what the installed extensions are on the computers running the tests. diff --git a/test/unit/FileHelperTest.php b/test/unit/FileHelperTest.php index 98731916b..3d59b4bc3 100755 --- a/test/unit/FileHelperTest.php +++ b/test/unit/FileHelperTest.php @@ -25,7 +25,6 @@ class FileHelperTest extends TestCase { - protected function setUp(): void { } diff --git a/test/unit/ManifestTest.php b/test/unit/ManifestTest.php index 9d87df9da..809f8e1ac 100755 --- a/test/unit/ManifestTest.php +++ b/test/unit/ManifestTest.php @@ -22,16 +22,15 @@ */ use oat\generis\test\TestCase; -use \oat\oatbox\extension\ComposerInfo; +use oat\oatbox\extension\ComposerInfo; use oat\oatbox\extension\Manifest; class ManifestTest extends TestCase { - - const SAMPLES_PATH = '/../../test/samples/manifests/'; - const MANIFEST_PATH_DOES_NOT_EXIST = 'idonotexist.php'; - const MANIFEST_PATH_LIGHTWEIGHT = 'lightweightManifest.php'; - const MANIFEST_PATH_COMPLEX = 'complexManifest.php'; + public const SAMPLES_PATH = '/../../test/samples/manifests/'; + public const MANIFEST_PATH_DOES_NOT_EXIST = 'idonotexist.php'; + public const MANIFEST_PATH_LIGHTWEIGHT = 'lightweightManifest.php'; + public const MANIFEST_PATH_COMPLEX = 'complexManifest.php'; private function getComposerInfoMock() { diff --git a/test/unit/ReportTest.php b/test/unit/ReportTest.php index 8a58916ba..a2a17ea61 100644 --- a/test/unit/ReportTest.php +++ b/test/unit/ReportTest.php @@ -84,7 +84,6 @@ public function testToArray() ], ]; $this->assertEquals($expectedArray, $report->toArray()); - } public function testBasicReport(): void @@ -384,8 +383,9 @@ public function testGetAllMessages(): void $report = Report::createInfo('1') ->add( Report::createSuccess('2') - ->add(Report::createWarning('3') - ) + ->add( + Report::createWarning('3') + ) ); self::assertEquals('1, 2, 3', $report->getAllMessages()); diff --git a/test/unit/UtilsTest.php b/test/unit/UtilsTest.php index 36a660258..3e8842bf4 100755 --- a/test/unit/UtilsTest.php +++ b/test/unit/UtilsTest.php @@ -61,7 +61,7 @@ public function testPhpStringEscaping() } $value = eval("return " . common_Utils::toPHPVariableString($all) . ";"); $this->assertEquals($all, $value); - + $serialized = serialize(new stdClass()); $value = eval("return " . common_Utils::toPHPVariableString($serialized) . ";"); $this->assertEquals($serialized, $value); diff --git a/test/unit/common/ext/ExtensionTest.php b/test/unit/common/ext/ExtensionTest.php index 52cf28927..d8848a07a 100644 --- a/test/unit/common/ext/ExtensionTest.php +++ b/test/unit/common/ext/ExtensionTest.php @@ -1,4 +1,5 @@ dir = $dir; } public function getDir() { - return $this->dir.$this->getId().DIRECTORY_SEPARATOR; + return $this->dir . $this->getId() . DIRECTORY_SEPARATOR; } }; $ext->setServiceLocator($this->getServiceLocatorMock([])); diff --git a/test/unit/common/ext/samples/UpdaterMock.php b/test/unit/common/ext/samples/UpdaterMock.php index 2cb32c627..5f0fa4245 100644 --- a/test/unit/common/ext/samples/UpdaterMock.php +++ b/test/unit/common/ext/samples/UpdaterMock.php @@ -1,4 +1,5 @@ subject->expiresAfter('string'); } - + public function getPrivateProperty(string $className, string $propertyName): ReflectionProperty { diff --git a/test/unit/common/oatbox/log/logger/handler/FluentdHandlerTest.php b/test/unit/common/oatbox/log/logger/handler/FluentdHandlerTest.php index 6dbfff604..3ee20fede 100644 --- a/test/unit/common/oatbox/log/logger/handler/FluentdHandlerTest.php +++ b/test/unit/common/oatbox/log/logger/handler/FluentdHandlerTest.php @@ -43,7 +43,6 @@ public function testConstruct() public function testConstructThrowsTypeException() { $this->expectException(\TypeError::class); - new FluentdHandler(FluentLogger::class.'foo'); + new FluentdHandler(FluentLogger::class . 'foo'); } - } diff --git a/test/unit/common/persistence/KeyValuePersistenceTest.php b/test/unit/common/persistence/KeyValuePersistenceTest.php index eebe894db..94e13b29c 100644 --- a/test/unit/common/persistence/KeyValuePersistenceTest.php +++ b/test/unit/common/persistence/KeyValuePersistenceTest.php @@ -56,12 +56,12 @@ public function setUp(): void /* * In memory persistence */ - $this->largeValuePersistence = new \common_persistence_KeyValuePersistence( - [ - \common_persistence_KeyValuePersistence::MAX_VALUE_SIZE => 100 - ], - $this->driver - ); + $this->largeValuePersistence = new \common_persistence_KeyValuePersistence( + [ + \common_persistence_KeyValuePersistence::MAX_VALUE_SIZE => 100 + ], + $this->driver + ); } public function tearDown(): void diff --git a/test/unit/common/persistence/NoStoragePersistenceTest.php b/test/unit/common/persistence/NoStoragePersistenceTest.php index 596bbf2f2..d26d40944 100644 --- a/test/unit/common/persistence/NoStoragePersistenceTest.php +++ b/test/unit/common/persistence/NoStoragePersistenceTest.php @@ -22,12 +22,11 @@ namespace oat\generis\test\unit\common\persistence; -use \common_persistence_NoStorageKvDriver; +use common_persistence_NoStorageKvDriver; use oat\generis\test\TestCase; class NoStaragePersistenceTest extends TestCase { - /** * * @author Lionel Lecaque, lionel@taotesting.com @@ -41,7 +40,7 @@ public function testConnect() $this->assertInstanceOf('common_persistence_KeyValuePersistence', $persistence); return $persistence; } - + /** * @depends testConnect * @author Lionel Lecaque, lionel@taotesting.com @@ -51,7 +50,7 @@ public function testSet($persistence) { $this->assertFalse($persistence->set('fakeKeyName', 'value')); } - + /** * @depends testConnect * @author Lionel Lecaque, lionel@taotesting.com @@ -61,8 +60,8 @@ public function testGet($persistence) { $this->assertFalse($persistence->get('fakeKeyName')); } - - + + /** * @depends testConnect * @author Lionel Lecaque, lionel@taotesting.com @@ -72,7 +71,7 @@ public function testExists($persistence) { $this->assertFalse($persistence->exists('fakeKeyName')); } - + /** * @depends testConnect * @author Lionel Lecaque, lionel@taotesting.com @@ -80,10 +79,10 @@ public function testExists($persistence) */ public function testDel($persistence) { - + $this->assertTrue($persistence->del('fakeKeyName')); } - + /** * @depends testConnect * @author Lionel Lecaque, lionel@taotesting.com diff --git a/test/unit/common/persistence/PersistenceManagerTest.php b/test/unit/common/persistence/PersistenceManagerTest.php index d447fc63b..23dffd27c 100644 --- a/test/unit/common/persistence/PersistenceManagerTest.php +++ b/test/unit/common/persistence/PersistenceManagerTest.php @@ -128,7 +128,7 @@ public function testApplySchema(SchemaCollection $sc) public function testApplySchemaProvider() { - $serviceClass = new class implements SchemaProviderInterface { + $serviceClass = new class () implements SchemaProviderInterface { public function provideSchema(SchemaCollection $schemaCollection) { $table = $schemaCollection->getSchema('sql1')->createTable('serviceTable'); @@ -152,4 +152,4 @@ protected function getSqlConfig() ] ]; } -} \ No newline at end of file +} diff --git a/test/unit/common/persistence/PhpFilePersistenceTtlModeTest.php b/test/unit/common/persistence/PhpFilePersistenceTtlModeTest.php index 362c7b346..303381d4a 100644 --- a/test/unit/common/persistence/PhpFilePersistenceTtlModeTest.php +++ b/test/unit/common/persistence/PhpFilePersistenceTtlModeTest.php @@ -22,7 +22,7 @@ namespace oat\generis\test\unit\common\persistence; -use \common_persistence_PhpFileDriver; +use common_persistence_PhpFileDriver; use oat\generis\test\integration\tools\InvokeMethodTrait; use org\bovigo\vfs\vfsStream; use oat\generis\test\TestCase; @@ -37,7 +37,7 @@ class PhpFilePersistenceTtlModeTest extends TestCase /** * The used TTL value. */ - const TTL = 15; + public const TTL = 15; private $root; diff --git a/test/unit/common/persistence/sql/PlatformTest.php b/test/unit/common/persistence/sql/PlatformTest.php index aed97fb02..6227e4803 100644 --- a/test/unit/common/persistence/sql/PlatformTest.php +++ b/test/unit/common/persistence/sql/PlatformTest.php @@ -28,7 +28,6 @@ class PlatformTest extends TestCase { - public function testGetQueryBuilder() { $platform = $this->createInstance(); diff --git a/test/unit/common/persistence/sql/dbal/DriverTest.php b/test/unit/common/persistence/sql/dbal/DriverTest.php index 18d45fdc5..2f354e585 100644 --- a/test/unit/common/persistence/sql/dbal/DriverTest.php +++ b/test/unit/common/persistence/sql/dbal/DriverTest.php @@ -29,7 +29,6 @@ */ class DriverTest extends TestCase { - public function testGetPlatForm() { if (!extension_loaded('pdo_sqlite')) { diff --git a/test/unit/common/session/BasicSessionTest.php b/test/unit/common/session/BasicSessionTest.php index 8d3c990a5..3cdbe3130 100644 --- a/test/unit/common/session/BasicSessionTest.php +++ b/test/unit/common/session/BasicSessionTest.php @@ -28,7 +28,7 @@ class BasicSessionTest extends TestCase { - public function testGetContext() : void + public function testGetContext(): void { $user = $this->prophesize(User::class)->reveal(); $context1 = $this->prophesize(SessionContext::class)->reveal(); @@ -40,5 +40,4 @@ public function testGetContext() : void $session = new \common_session_BasicSession($user, [$context1, $context2]); $this->assertEquals([$context1, $context2], $session->getContexts()); } - } diff --git a/test/unit/core/UrlFileSerializerTest.php b/test/unit/core/UrlFileSerializerTest.php index fec163b8b..b13df1657 100755 --- a/test/unit/core/UrlFileSerializerTest.php +++ b/test/unit/core/UrlFileSerializerTest.php @@ -37,37 +37,37 @@ public function testSerialize() $file = $fileP->reveal(); $baseDir = $this->prophesize(Directory::class); $baseDir->getRelPath($file)->willReturn('sample~Path.txt'); - + $fsMock = $this->prophesize(FileSystemService::class); $fsMock->getDirectory('sampleFs')->willReturn($baseDir->reveal()); - + $serializer = new UrlFileSerializer(); $serializer->setServiceLocator($this->getServiceLocatorMock([ FileSystemService::SERVICE_ID => $fsMock->reveal() ])); - + $serial = $serializer->serialize($file); $this->assertEquals('file://sampleFs/sample%7EPath.txt', $serial); } - + public function testUnSerialize() { $file = $this->prophesize(File::class)->reveal(); $baseDir = $this->prophesize(Directory::class); $baseDir->getFile("sample~Path.txt")->willReturn($file); - + $fsMock = $this->prophesize(FileSystemService::class); $fsMock->getDirectory('sampleFs')->willReturn($baseDir->reveal()); - + $serializer = new UrlFileSerializer(); $serializer->setServiceLocator($this->getServiceLocatorMock([ FileSystemService::SERVICE_ID => $fsMock->reveal() ])); - + $unserialized = $serializer->unserialize('file://sampleFs/sample%7EPath.txt'); $this->assertEquals($file, $unserialized); } - + /** * @dataProvider invalidUrlReferenceProvider */ @@ -77,7 +77,7 @@ public function testInvalidUrlFile($url) $serializer = new UrlFileSerializer(); $serializer->unserialize($url); } - + public function invalidUrlReferenceProvider() { return [ diff --git a/test/unit/core/data/import/RdfImportTest.php b/test/unit/core/data/import/RdfImportTest.php index 891dde8e7..8bf6bec64 100644 --- a/test/unit/core/data/import/RdfImportTest.php +++ b/test/unit/core/data/import/RdfImportTest.php @@ -50,7 +50,7 @@ public function testRdfFileImport(Ontology $ontology) $this->assertEquals(0, $this->getTripleCount($ontology)); $importer = new RdfImporter(); $importer->setServiceLocator($ontology->getServiceLocator()); - $importer->importFile(__DIR__.'/../../../../samples/rdf/generis.rdf'); + $importer->importFile(__DIR__ . '/../../../../samples/rdf/generis.rdf'); $this->assertEquals(3, $this->getTripleCount($ontology)); } diff --git a/test/unit/core/data/permission/PermissionTest.php b/test/unit/core/data/permission/PermissionTest.php index 3821f3d37..4ce9b2cce 100644 --- a/test/unit/core/data/permission/PermissionTest.php +++ b/test/unit/core/data/permission/PermissionTest.php @@ -30,7 +30,7 @@ class PermissionTest extends TestCase { - const RIGHT = 'testRight'; + public const RIGHT = 'testRight'; /** * @dataProvider getSamples */ @@ -61,8 +61,8 @@ public function getSamples() [[self::RIGHT], ['a', 'b'], [], []], [[self::RIGHT], [1,2,3,4,5], [1 => [self::RIGHT]], [1]], [[self::RIGHT], [1,2,3,4,5], [2 => [self::RIGHT, 'somethingelse']], [1 => 2]], - [[self::RIGHT], [1,2,3,4,5], [2 => [self::RIGHT], 3 =>['somethingelse']], [1 => 2]], - [[self::RIGHT], [1,2,3,4,5], [2 => [self::RIGHT], 4 =>[self::RIGHT]], [1 => 2, 3 => 4]], + [[self::RIGHT], [1,2,3,4,5], [2 => [self::RIGHT], 3 => ['somethingelse']], [1 => 2]], + [[self::RIGHT], [1,2,3,4,5], [2 => [self::RIGHT], 4 => [self::RIGHT]], [1 => 2, 3 => 4]], [[self::RIGHT, 'weird'], [1,2,3,4,5], [1 => [self::RIGHT]], [1]], [[], [1,2,3,4,5], [], [1,2,3,4,5]], [['weird'], [1,2,3,4,5], [], [1,2,3,4,5]] diff --git a/test/unit/core/kernel/classes/ClassTest.php b/test/unit/core/kernel/classes/ClassTest.php index c9d3bcbcd..ce3fa8967 100644 --- a/test/unit/core/kernel/classes/ClassTest.php +++ b/test/unit/core/kernel/classes/ClassTest.php @@ -184,7 +184,7 @@ private function createSubClasses(array $subClassesLabels) // Passing an associative array allows to specify the number of events triggered. if (isset($subClassesLabels[0])) { $subClassesLabels = array_combine( - $subClassesLabels, + $subClassesLabels, array_fill(0, count($subClassesLabels), 0) ); } diff --git a/test/unit/extension/ComposerInfoTest.php b/test/unit/extension/ComposerInfoTest.php index 4a377a4b7..9208c6780 100644 --- a/test/unit/extension/ComposerInfoTest.php +++ b/test/unit/extension/ComposerInfoTest.php @@ -33,7 +33,6 @@ */ class ComposerInfoTest extends TestCase { - public function testGetAvailableTaoExtensions() { $instance = new ComposerInfo($this->getSamplesDir()); @@ -57,14 +56,13 @@ public function testGetPackageId() private function getSamplesDir() { - return realpath(__DIR__.DIRECTORY_SEPARATOR. - '..'.DIRECTORY_SEPARATOR. - '..'.DIRECTORY_SEPARATOR. - 'samples'. - DIRECTORY_SEPARATOR. + return realpath( + __DIR__ . DIRECTORY_SEPARATOR . + '..' . DIRECTORY_SEPARATOR . + '..' . DIRECTORY_SEPARATOR . + 'samples' . + DIRECTORY_SEPARATOR . 'manifests' ); } - - -} \ No newline at end of file +} diff --git a/test/unit/helpers/FileTest.php b/test/unit/helpers/FileTest.php index f5490c93f..731b1c70a 100644 --- a/test/unit/helpers/FileTest.php +++ b/test/unit/helpers/FileTest.php @@ -39,25 +39,25 @@ protected function setUp(): void mkdir($this->dir); $this->subDir = $this->dir . 'sub' ; mkdir($this->subDir); - $this->file1 = $this->dir. DIRECTORY_SEPARATOR . 'test1.txt'; - touch($this->dir. DIRECTORY_SEPARATOR . 'test1.txt'); - $this->file2 = $this->subDir. DIRECTORY_SEPARATOR . 'test2.txt'; - touch($this->subDir. DIRECTORY_SEPARATOR . 'test2.txt'); + $this->file1 = $this->dir . DIRECTORY_SEPARATOR . 'test1.txt'; + touch($this->dir . DIRECTORY_SEPARATOR . 'test1.txt'); + $this->file2 = $this->subDir . DIRECTORY_SEPARATOR . 'test2.txt'; + touch($this->subDir . DIRECTORY_SEPARATOR . 'test2.txt'); } public function testInDirectory() { $this->assertTrue(\helpers_File::isFileInsideDirectory('test1.txt', $this->dir)); $this->assertFalse(\helpers_File::isFileInsideDirectory('test2.txt', $this->dir)); - $this->assertTrue(\helpers_File::isFileInsideDirectory('test1.txt', $this->dir.DIRECTORY_SEPARATOR)); - $this->assertFalse(\helpers_File::isFileInsideDirectory('sub'.DIRECTORY_SEPARATOR.'test2.txt', $this->dir)); - $this->assertFalse(\helpers_File::isFileInsideDirectory('sub'.DIRECTORY_SEPARATOR.'test2.txt', $this->dir.DIRECTORY_SEPARATOR)); + $this->assertTrue(\helpers_File::isFileInsideDirectory('test1.txt', $this->dir . DIRECTORY_SEPARATOR)); + $this->assertFalse(\helpers_File::isFileInsideDirectory('sub' . DIRECTORY_SEPARATOR . 'test2.txt', $this->dir)); + $this->assertFalse(\helpers_File::isFileInsideDirectory('sub' . DIRECTORY_SEPARATOR . 'test2.txt', $this->dir . DIRECTORY_SEPARATOR)); $this->assertFalse(\helpers_File::isFileInsideDirectory('test1.txt', $this->subDir)); - $this->assertFalse(\helpers_File::isFileInsideDirectory('test1.txt', $this->subDir.DIRECTORY_SEPARATOR)); + $this->assertFalse(\helpers_File::isFileInsideDirectory('test1.txt', $this->subDir . DIRECTORY_SEPARATOR)); $this->assertTrue(\helpers_File::isFileInsideDirectory('test2.txt', $this->subDir)); - $this->assertFalse(\helpers_File::isFileInsideDirectory('sub'.DIRECTORY_SEPARATOR.'test2.txt', $this->subDir)); - $this->assertFalse(\helpers_File::isFileInsideDirectory('sub'.DIRECTORY_SEPARATOR.'test2.txt', $this->subDir.DIRECTORY_SEPARATOR)); + $this->assertFalse(\helpers_File::isFileInsideDirectory('sub' . DIRECTORY_SEPARATOR . 'test2.txt', $this->subDir)); + $this->assertFalse(\helpers_File::isFileInsideDirectory('sub' . DIRECTORY_SEPARATOR . 'test2.txt', $this->subDir . DIRECTORY_SEPARATOR)); } protected function tearDown(): void diff --git a/test/unit/helpers/SystemHelperTest.php b/test/unit/helpers/SystemHelperTest.php index 8d56c1e2e..1667119e1 100644 --- a/test/unit/helpers/SystemHelperTest.php +++ b/test/unit/helpers/SystemHelperTest.php @@ -26,7 +26,6 @@ class SystemHelperTest extends TestCase { - /** * @dataProvider sizeProvider */ diff --git a/test/unit/helpers/UuidPrimaryKeyHelperTest.php b/test/unit/helpers/UuidPrimaryKeyHelperTest.php index 0317003f2..f829c29b0 100644 --- a/test/unit/helpers/UuidPrimaryKeyHelperTest.php +++ b/test/unit/helpers/UuidPrimaryKeyHelperTest.php @@ -29,7 +29,7 @@ class UuidPrimaryKeyTraitTest extends TestCase { public function testGetUniquePrimaryKey() { - $fixture = new class { + $fixture = new class () { use UuidPrimaryKeyTrait; }; diff --git a/test/unit/model/ResourceFormatterTest.php b/test/unit/model/ResourceFormatterTest.php index 6d7b09649..0fd4eb496 100644 --- a/test/unit/model/ResourceFormatterTest.php +++ b/test/unit/model/ResourceFormatterTest.php @@ -21,7 +21,7 @@ namespace oat\generis\test\unit\model; use common_exception_NoContent; -use \core_kernel_classes_ResourceFormatter; +use core_kernel_classes_ResourceFormatter; use oat\generis\model\GenerisRdf; use oat\generis\test\TestCase; @@ -230,7 +230,7 @@ public function testGetResourceDesciption() $this->assertInstanceOf('stdClass', $result->properties[0]); $this->assertSame('#predicate0', $result->properties[0]->predicateUri); $this->assertIsArray($result->properties[0]->values); - $this->assertCount(1,$result->properties[0]->values); + $this->assertCount(1, $result->properties[0]->values); $this->assertInstanceOf('stdClass', $result->properties[0]->values[0]); $this->assertSame('resource', $result->properties[0]->values[0]->valueType); @@ -240,7 +240,7 @@ public function testGetResourceDesciption() $this->assertInstanceOf('stdClass', $result->properties[$i]); $this->assertSame('#predicate' . $i, $result->properties[$i]->predicateUri); $this->assertIsArray($result->properties[$i]->values); - $this->assertCount(1,$result->properties[$i]->values); + $this->assertCount(1, $result->properties[$i]->values); $this->assertInstanceOf('stdClass', $result->properties[$i]->values[0]); $this->assertSame('literal', $result->properties[$i]->values[0]->valueType); diff --git a/test/unit/model/persistence/newsql/NewSqlRdfTest.php b/test/unit/model/persistence/newsql/NewSqlRdfTest.php index 48f95d517..b31844ab9 100644 --- a/test/unit/model/persistence/newsql/NewSqlRdfTest.php +++ b/test/unit/model/persistence/newsql/NewSqlRdfTest.php @@ -54,9 +54,8 @@ public function testAdd() $persistence = $this->getPersistenceProphecy(); $persistence->exec( $query, - Argument::that(function($value) use ($expected) { - return array_slice($value, 1) == $expected && is_string($value[0]); - + Argument::that(function ($value) use ($expected) { + return array_slice($value, 1) == $expected && is_string($value[0]); }), $this->getExpectedTripleParameterTypes() )->shouldBeCalled()->willReturn(true); @@ -111,7 +110,7 @@ public function testAddTripleCollection() $persistence = $this->getPersistenceProphecy(); $persistence->insertMultiple( Argument::exact($table), - Argument::that(function($value) use ($expectedValue) { + Argument::that(function ($value) use ($expectedValue) { return array_slice($value[0], 1) == $expectedValue[0] && is_string($value[0]['id']) && array_slice($value[1], 1) == $expectedValue[1] && is_string($value[1]['id']); }), @@ -137,7 +136,8 @@ protected function createRdfSubject($persistence) $model = $this->prophesize(NewSqlOntology::class); $model->getPersistence()->willReturn($persistence); - return new NewSqlRdf($model->reveal());; + return new NewSqlRdf($model->reveal()); + ; } protected function getExpectedTripleParameterTypes() diff --git a/test/unit/model/persistence/smoothsql/SmoothModelIteratorTest.php b/test/unit/model/persistence/smoothsql/SmoothModelIteratorTest.php index 1985df92a..c0b7d47bc 100644 --- a/test/unit/model/persistence/smoothsql/SmoothModelIteratorTest.php +++ b/test/unit/model/persistence/smoothsql/SmoothModelIteratorTest.php @@ -27,7 +27,6 @@ class SmoothModelIteratorTest extends TestCase { - public function setUp(): void { } diff --git a/test/unit/model/persistence/smoothsql/SmoothRdfTest.php b/test/unit/model/persistence/smoothsql/SmoothRdfTest.php index af3fea59f..c8e6a09a7 100644 --- a/test/unit/model/persistence/smoothsql/SmoothRdfTest.php +++ b/test/unit/model/persistence/smoothsql/SmoothRdfTest.php @@ -24,7 +24,7 @@ namespace oat\generis\test\unit\model\persistence\smoothsql; use common_Exception; -use \core_kernel_persistence_smoothsql_SmoothRdf; +use core_kernel_persistence_smoothsql_SmoothRdf; use Doctrine\DBAL\ParameterType; use Prophecy\Argument; use Prophecy\Prophet; diff --git a/test/unit/oatbox/ConfigurableTest.php b/test/unit/oatbox/ConfigurableTest.php index 2740a4d4f..a04feb26c 100644 --- a/test/unit/oatbox/ConfigurableTest.php +++ b/test/unit/oatbox/ConfigurableTest.php @@ -1,4 +1,5 @@ prophesize(CallableListener::class); $callable->invoke(Argument::any())->should(new CallTimesPrediction(1)); - + $this->eventManager->attach('testEvent', [$callable->reveal(), 'invoke']); $this->eventManager->trigger('testEvent'); } - + public function testListenerIsInvokedWhenAttachedToMultipleEvents(): void { $callable = $this->prophesize(CallableListener::class); diff --git a/test/unit/oatbox/cache/KeyValueCacheTest.php b/test/unit/oatbox/cache/KeyValueCacheTest.php index 2458c15ae..629c431de 100644 --- a/test/unit/oatbox/cache/KeyValueCacheTest.php +++ b/test/unit/oatbox/cache/KeyValueCacheTest.php @@ -29,6 +29,7 @@ class KeyValueCacheTest extends TestCase { use KeyValueMockTrait; + /** * @var KeyValueCache */ diff --git a/test/unit/oatbox/config/ConfigSetsTest.php b/test/unit/oatbox/config/ConfigSetsTest.php index 3f0f37b84..d183b0ae1 100644 --- a/test/unit/oatbox/config/ConfigSetsTest.php +++ b/test/unit/oatbox/config/ConfigSetsTest.php @@ -33,7 +33,6 @@ */ class ConfigSetsTest extends TestCase { - /** * @var ConfigSets */ diff --git a/test/unit/oatbox/event/EventAggregatorTest.php b/test/unit/oatbox/event/EventAggregatorTest.php index bbf19a875..314b974dd 100644 --- a/test/unit/oatbox/event/EventAggregatorTest.php +++ b/test/unit/oatbox/event/EventAggregatorTest.php @@ -61,7 +61,7 @@ public function testTriggerEventsWhenNumberOfAggregatedEventsReachesTheMaximum() ->method('trigger'); $this->mockDebugLogger('Triggering 2 aggregated events'); - $eventAggregator = new EventAggregator(['numberOfAggregatedEvents'=>2]); + $eventAggregator = new EventAggregator(['numberOfAggregatedEvents' => 2]); $eventAggregator->setServiceLocator($this->serviceLocator); $eventAggregator->put('event1', new GenericEvent('wwwww')); @@ -73,7 +73,7 @@ public function testTriggerOneEventWhenEventsAreDuplicated(): void ->method('trigger'); $this->mockDebugLogger('Triggering 1 aggregated events'); - $eventAggregator = new EventAggregator(['numberOfAggregatedEvents'=>2]); + $eventAggregator = new EventAggregator(['numberOfAggregatedEvents' => 2]); $eventAggregator->setServiceLocator($this->serviceLocator); $eventAggregator->put('event1', new GenericEvent('wwwww')); @@ -87,7 +87,7 @@ public function testDoNotTriggerEventsWhenNumberOfAggregatedEventsIsLessThanTheM ->method('trigger'); $this->logger->expects($this->never())->method('info'); - $eventAggregator = new EventAggregator(['numberOfAggregatedEvents'=>4]); + $eventAggregator = new EventAggregator(['numberOfAggregatedEvents' => 4]); $eventAggregator->setServiceLocator($this->serviceLocator); $eventAggregator->put('event1', new GenericEvent('wwwww')); @@ -100,7 +100,7 @@ public function testDoNotLogWhenThereIsNoEvents(): void $this->logger->expects($this->never())->method('info'); - $eventAggregator = new EventAggregator(['numberOfAggregatedEvents'=>4]); + $eventAggregator = new EventAggregator(['numberOfAggregatedEvents' => 4]); $eventAggregator->setServiceLocator($this->serviceLocator); $eventAggregator->triggerAggregatedEvents(); } @@ -111,7 +111,7 @@ public function testTriggerAggregatedEvents(): void ->method('trigger'); $this->mockDebugLogger('Triggering 1 aggregated events'); - $eventAggregator = new EventAggregator(['numberOfAggregatedEvents'=>3]); + $eventAggregator = new EventAggregator(['numberOfAggregatedEvents' => 3]); $eventAggregator->setServiceLocator($this->serviceLocator); $eventAggregator->put('event1', new GenericEvent('wwwww')); diff --git a/test/unit/oatbox/extension/InstallActionTest.php b/test/unit/oatbox/extension/InstallActionTest.php index fc76539e5..376d95902 100644 --- a/test/unit/oatbox/extension/InstallActionTest.php +++ b/test/unit/oatbox/extension/InstallActionTest.php @@ -32,14 +32,13 @@ */ class InstallActionTest extends TestCase { - public function testRegisterEvent() { - + $event = 'testEvent'; $callBack = function () { }; - + $instance = $this->getMockForAbstractClass( InstallAction::class, [], @@ -49,35 +48,35 @@ public function testRegisterEvent() true, ['getServiceLocator' , 'getServiceManager'] ); - + $prophetServiceManager = $this->prophesize(ServiceManager::class); $prophetEventManager = $this->prophesize(EventManager::class); - + $prophetEventManager->attach($event, $callBack)->willReturn(null); - + $EventManagerMock = $prophetEventManager->reveal(); - + $prophetServiceManager->get(EventManager::CONFIG_ID)->willReturn($EventManagerMock); $prophetServiceManager->register(EventManager::CONFIG_ID, $EventManagerMock)->willReturn(null); - + $serviceManagerMock = $prophetServiceManager->reveal(); - + $instance->expects($this->once()) ->method('getServiceLocator') ->willReturn($serviceManagerMock); - + $instance->expects($this->once()) ->method('getServiceManager') ->willReturn($serviceManagerMock); - + $instance->registerEvent($event, $callBack); } - + public function testRegisterService() { - + $fixtureService = 'test/service'; - + $instance = $this->getMockForAbstractClass( InstallAction::class, [], @@ -87,22 +86,22 @@ public function testRegisterService() true, ['getServiceManager'] ); - + $serviceProphet = $this->prophesize()->willExtend(\oat\oatbox\service\ConfigurableService::class); - + $prophetServiceManager = $this->prophesize(ServiceManager::class); $serviceManagerMock = $prophetServiceManager->reveal(); - + $serviceProphet->setServiceLocator($serviceManagerMock)->willReturn($serviceProphet); $serviceMock = $serviceProphet->reveal(); - + $prophetServiceManager->register($fixtureService, $serviceMock)->willReturn(null); $serviceManagerMock = $prophetServiceManager->reveal(); - + $instance->expects($this->exactly(1)) ->method('getServiceManager') ->willReturn($serviceManagerMock); - + $instance->registerService($fixtureService, $serviceMock); } } diff --git a/test/unit/oatbox/extension/UninstallActionTest.php b/test/unit/oatbox/extension/UninstallActionTest.php index 5230afee6..2e9fabf75 100644 --- a/test/unit/oatbox/extension/UninstallActionTest.php +++ b/test/unit/oatbox/extension/UninstallActionTest.php @@ -32,14 +32,13 @@ */ class UninstallActionTest extends TestCase { - public function testUnregisterEvent() { - + $event = 'testEvent'; $callBack = function () { }; - + $instance = $this->getMockForAbstractClass( UninstallAction::class, [], @@ -49,35 +48,35 @@ public function testUnregisterEvent() true, ['getServiceLocator' , 'getServiceManager'] ); - + $prophetServiceManager = $this->prophesize(ServiceManager::class); $prophetEventManager = $this->prophesize(EventManager::class); - + $prophetEventManager->detach($event, $callBack)->willReturn(null); - + $EventManagerMock = $prophetEventManager->reveal(); - + $prophetServiceManager->get(EventManager::CONFIG_ID)->willReturn($EventManagerMock); $prophetServiceManager->register(EventManager::CONFIG_ID, $EventManagerMock)->willReturn(null); - + $serviceManagerMock = $prophetServiceManager->reveal(); - + $instance->expects($this->once()) ->method('getServiceLocator') ->willReturn($serviceManagerMock); - + $instance->expects($this->once()) ->method('getServiceManager') ->willReturn($serviceManagerMock); - + $instance->unregisterEvent($event, $callBack); } - + public function testUnregisterService() { - + $fixtureService = 'test/service'; - + $instance = $this->getMockForAbstractClass( UninstallAction::class, [], @@ -87,15 +86,15 @@ public function testUnregisterService() true, ['getServiceManager'] ); - + $prophetServiceManager = $this->prophesize(ServiceManager::class); $prophetServiceManager->unregister($fixtureService)->willReturn(null); $serviceManagerMock = $prophetServiceManager->reveal(); - + $instance->expects($this->once()) ->method('getServiceManager') ->willReturn($serviceManagerMock); - + $instance->unregisterService($fixtureService); } } diff --git a/test/unit/oatbox/extension/script/OptionContainerTest.php b/test/unit/oatbox/extension/script/OptionContainerTest.php index 170c2a9c7..60553978c 100644 --- a/test/unit/oatbox/extension/script/OptionContainerTest.php +++ b/test/unit/oatbox/extension/script/OptionContainerTest.php @@ -26,7 +26,6 @@ class OptionContainerTest extends TestCase { - /** * @dataProvider instantiateProvider */ diff --git a/test/unit/oatbox/log/LoggerServiceTest.php b/test/unit/oatbox/log/LoggerServiceTest.php index e2f3e48dd..9b940eef6 100755 --- a/test/unit/oatbox/log/LoggerServiceTest.php +++ b/test/unit/oatbox/log/LoggerServiceTest.php @@ -19,6 +19,7 @@ * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); * */ + namespace oat\generis\test\unit\oatbox\log; use oat\oatbox\log\LoggerService; @@ -27,8 +28,7 @@ class LoggerServiceTest extends TestCase { - - const RUNS = 1000; + public const RUNS = 1000; protected function setUp(): void { diff --git a/test/unit/oatbox/mutex/LockServiceTest.php b/test/unit/oatbox/mutex/LockServiceTest.php index 4fdde82b3..3f6d8be19 100644 --- a/test/unit/oatbox/mutex/LockServiceTest.php +++ b/test/unit/oatbox/mutex/LockServiceTest.php @@ -35,8 +35,6 @@ */ class LockServiceTest extends TestCase { - - public function testLock() { $dir = sys_get_temp_dir() . DIRECTORY_SEPARATOR . "generis_unittest_" . mt_rand() . DIRECTORY_SEPARATOR; diff --git a/test/unit/oatbox/service/EnvironmentVariableTest.php b/test/unit/oatbox/service/EnvironmentVariableTest.php index 3a996c710..8719b42d5 100644 --- a/test/unit/oatbox/service/EnvironmentVariableTest.php +++ b/test/unit/oatbox/service/EnvironmentVariableTest.php @@ -27,7 +27,7 @@ class EnvironmentVariableTest extends TestCase { - const VAR_NAME = 'That\'s the variable\'s name.'; + public const VAR_NAME = 'That\'s the variable\'s name.'; /** @var EnvironmentVariable */ private $subject; diff --git a/test/unit/oatbox/service/ServiceManagerTest.php b/test/unit/oatbox/service/ServiceManagerTest.php index f849e25df..db9287adc 100644 --- a/test/unit/oatbox/service/ServiceManagerTest.php +++ b/test/unit/oatbox/service/ServiceManagerTest.php @@ -64,14 +64,14 @@ public function testWithoutAutowire() interface TestServiceInterface1 { - const SERVICE_ID = 'test/TestService1'; + public const SERVICE_ID = 'test/TestService1'; } class TestService1 extends ConfigurableService implements TestServiceInterface1 { } class TestService2 extends ConfigurableService { - const SERVICE_ID = 'test/TestService2'; + public const SERVICE_ID = 'test/TestService2'; } class TestService2_2 extends TestService2 { @@ -79,5 +79,4 @@ class TestService2_2 extends TestService2 class TestService3 extends ConfigurableService { - } From fe1be2db3e84e666d1cfa27a56645d77e046c9d1 Mon Sep 17 00:00:00 2001 From: Andrei Shapiro Date: Thu, 11 May 2023 12:20:20 +0000 Subject: [PATCH 2/5] chore: apply PSR-12 manual fixes --- common/cache/class.PartitionedCachable.php | 5 +++- common/cache/class.SingletonCache.php | 2 +- .../class.BoundableComponent.php | 2 +- common/configuration/class.Component.php | 2 +- common/ext/class.AbstractExtension.php | 2 +- common/interface.Serializable.php | 2 +- common/legacy/class.LegacyAutoLoader.php | 2 ++ common/log/interface.Appender.php | 2 +- common/log/interface.SeverityLevel.php | 2 +- .../service/ServiceFactoryInterface.php | 4 +-- common/persistence/class.Persistence.php | 3 ++ common/uri/class.AbstractUriProvider.php | 2 +- config/default/SimpleCache.conf.php | 4 +-- config/default/session.conf.php | 4 +-- config/default/uriProvider.conf.php | 4 +-- core/kernel/api/interface.Api.php | 2 +- core/kernel/classes/class.DbWrapper.php | 2 ++ core/kernel/impl/class.ApiModelOO.php | 2 ++ .../interface.PropertyInterface.php | 2 +- core/kernel/persistence/newsql/NewSqlRdf.php | 4 +-- .../persistence/smoothsql/class.SmoothRdf.php | 4 +-- core/kernel/rules/class.Expression.php | 30 ++++++++----------- .../users/interface.UsersManagement.php | 2 +- test/bootstrap.php | 2 ++ test/integration/mutex/test_action.php | 2 ++ .../rules/ExpressionFactoryTest.php | 2 ++ test/integration/rules/ExpressionTest.php | 3 +- .../rules/OperationFactoryTest.php | 2 ++ test/integration/rules/OperationTest.php | 2 ++ test/integration/rules/TermFactoryTest.php | 2 ++ test/integration/rules/TermTest.php | 3 ++ test/samples/manifests/complexManifest.php | 3 +- .../samples/manifests/lightweightManifest.php | 3 +- test/unit/CollectionTest.php | 3 ++ test/unit/UtilsTest.php | 2 ++ ...session_php_KeyValueSessionHandlerTest.php | 4 +-- test/unit/extension/ComposerInfoTest.php | 4 +-- .../persistence/newsql/NewSqlRdfTest.php | 4 +-- .../persistence/smoothsql/SmoothRdfTest.php | 4 +-- 39 files changed, 79 insertions(+), 56 deletions(-) diff --git a/common/cache/class.PartitionedCachable.php b/common/cache/class.PartitionedCachable.php index b65ce49f0..33d003306 100644 --- a/common/cache/class.PartitionedCachable.php +++ b/common/cache/class.PartitionedCachable.php @@ -173,6 +173,8 @@ public function __wakeup() * @access public * @author Jerome Bogaerts, * @return mixed + * + * phpcs:disable PSR2.Methods.MethodDeclaration */ public function _remove() { @@ -183,6 +185,7 @@ public function _remove() $this->getCache()->remove($this->getSerial()); } } + // phpcs:enable PSR2.Methods.MethodDeclaration /** * Short description of method getSuccessors @@ -263,4 +266,4 @@ abstract protected function buildSerial(); * @return common_cache_Cache */ abstract public function getCache(); -} /* end of abstract class common_cache_PartitionedCachable */ +} diff --git a/common/cache/class.SingletonCache.php b/common/cache/class.SingletonCache.php index 6faf23780..5f077084d 100755 --- a/common/cache/class.SingletonCache.php +++ b/common/cache/class.SingletonCache.php @@ -113,4 +113,4 @@ public static function getCached($function) private function __construct() { } -} /* end of abstract class common_cache_SingletonCache */ +} diff --git a/common/configuration/class.BoundableComponent.php b/common/configuration/class.BoundableComponent.php index 3fc4ad6a4..ee7231378 100644 --- a/common/configuration/class.BoundableComponent.php +++ b/common/configuration/class.BoundableComponent.php @@ -152,4 +152,4 @@ public function getMax() * @return string */ abstract public function getValue(); -} /* end of abstract class common_configuration_BoundableComponent */ +} diff --git a/common/configuration/class.Component.php b/common/configuration/class.Component.php index c72f65925..4fafd22d9 100644 --- a/common/configuration/class.Component.php +++ b/common/configuration/class.Component.php @@ -144,4 +144,4 @@ public function setName($name) $this->name = $name; } -} /* end of abstract class common_configuration_Component */ +} diff --git a/common/ext/class.AbstractExtension.php b/common/ext/class.AbstractExtension.php index e846fc6b0..0986a80d2 100644 --- a/common/ext/class.AbstractExtension.php +++ b/common/ext/class.AbstractExtension.php @@ -81,4 +81,4 @@ public function getRequiredExtensions() public function getVersion() { } -} /* end of abstract class common_ext_AbstractExtension */ +} diff --git a/common/interface.Serializable.php b/common/interface.Serializable.php index 1f2410f62..b91f1ab26 100644 --- a/common/interface.Serializable.php +++ b/common/interface.Serializable.php @@ -41,4 +41,4 @@ interface common_Serializable * @return string */ public function getSerial(); -} /* end of interface common_Serializable */ +} diff --git a/common/legacy/class.LegacyAutoLoader.php b/common/legacy/class.LegacyAutoLoader.php index e7659fabe..b06a2c14d 100755 --- a/common/legacy/class.LegacyAutoLoader.php +++ b/common/legacy/class.LegacyAutoLoader.php @@ -185,4 +185,6 @@ private function wrapClass($legacyClass, $realClass) } } +// phpcs:disable PSR1.Files.SideEffects common_legacy_LegacyAutoLoader::register(); +// phpcs:enable PSR1.Files.SideEffects diff --git a/common/log/interface.Appender.php b/common/log/interface.Appender.php index bd2d0d151..f0cef44d6 100644 --- a/common/log/interface.Appender.php +++ b/common/log/interface.Appender.php @@ -62,4 +62,4 @@ public function getLogThreshold(); * @return boolean */ public function init($configuration); -} /* end of interface common_log_Appender */ +} diff --git a/common/log/interface.SeverityLevel.php b/common/log/interface.SeverityLevel.php index 2c517fea7..2dba1a595 100644 --- a/common/log/interface.SeverityLevel.php +++ b/common/log/interface.SeverityLevel.php @@ -40,4 +40,4 @@ interface common_log_SeverityLevel * @return int */ public function getSeverity(); -} /* end of interface common_log_SeverityLevel */ +} diff --git a/common/oatbox/service/ServiceFactoryInterface.php b/common/oatbox/service/ServiceFactoryInterface.php index f0bd189f4..294020878 100644 --- a/common/oatbox/service/ServiceFactoryInterface.php +++ b/common/oatbox/service/ServiceFactoryInterface.php @@ -1,7 +1,5 @@ " * @param array $params * @param common_persistence_driver $driver + * + * phpcs:disable PEAR.Functions.ValidDefaultValue */ public function __construct($params = [], common_persistence_driver $driver) { $this->setParams($params); $this->setDriver($driver); } + // phpcs:enable PEAR.Functions.ValidDefaultValue /** * Retrieve persistence's driver diff --git a/common/uri/class.AbstractUriProvider.php b/common/uri/class.AbstractUriProvider.php index fd9df0456..b95179d89 100644 --- a/common/uri/class.AbstractUriProvider.php +++ b/common/uri/class.AbstractUriProvider.php @@ -96,4 +96,4 @@ public function __construct($driver) $this->setDriver($driver); } -} /* end of abstract class common_uri_AbstractUriProvider */ +} diff --git a/config/default/SimpleCache.conf.php b/config/default/SimpleCache.conf.php index 98076b688..6843290e8 100644 --- a/config/default/SimpleCache.conf.php +++ b/config/default/SimpleCache.conf.php @@ -1,11 +1,11 @@ 'cache' ]); diff --git a/config/default/session.conf.php b/config/default/session.conf.php index 812c1d022..e65cbc3cd 100644 --- a/config/default/session.conf.php +++ b/config/default/session.conf.php @@ -1,9 +1,9 @@ LOCAL_NAMESPACE . '#' ]); diff --git a/core/kernel/api/interface.Api.php b/core/kernel/api/interface.Api.php index c68875aa9..5f7a00380 100644 --- a/core/kernel/api/interface.Api.php +++ b/core/kernel/api/interface.Api.php @@ -55,4 +55,4 @@ public function logIn($login, $password, $module, $role); * @return boolean */ public function logOut(); -} /* end of interface core_kernel_api_Api */ +} diff --git a/core/kernel/classes/class.DbWrapper.php b/core/kernel/classes/class.DbWrapper.php index c276705a5..4f93387cd 100644 --- a/core/kernel/classes/class.DbWrapper.php +++ b/core/kernel/classes/class.DbWrapper.php @@ -21,7 +21,9 @@ * */ +// phpcs:disable PSR1.Files.SideEffects error_reporting(E_ALL); +// phpcs:enable PSR1.Files.SideEffects /** diff --git a/core/kernel/impl/class.ApiModelOO.php b/core/kernel/impl/class.ApiModelOO.php index f353ad4b3..69fe32068 100644 --- a/core/kernel/impl/class.ApiModelOO.php +++ b/core/kernel/impl/class.ApiModelOO.php @@ -29,7 +29,9 @@ use oat\oatbox\service\ServiceManager; use Zend\ServiceManager\ServiceLocatorInterface; +// phpcs:disable PSR1.Files.SideEffects error_reporting(E_ALL); +// phpcs:enable PSR1.Files.SideEffects /** * Generis Object Oriented API - core\kernel\impl\class.ApiModelOO.php diff --git a/core/kernel/persistence/interface.PropertyInterface.php b/core/kernel/persistence/interface.PropertyInterface.php index 76436ff45..a4a7e89cc 100644 --- a/core/kernel/persistence/interface.PropertyInterface.php +++ b/core/kernel/persistence/interface.PropertyInterface.php @@ -108,4 +108,4 @@ public function setMultiple(core_kernel_classes_Resource $resource, $isMultiple) * @return void */ public function setLgDependent(core_kernel_classes_Resource $resource, $isLgDependent); -} /* end of interface core_kernel_persistence_PropertyInterface */ +} diff --git a/core/kernel/persistence/newsql/NewSqlRdf.php b/core/kernel/persistence/newsql/NewSqlRdf.php index fae95b96c..5fa5d63ae 100644 --- a/core/kernel/persistence/newsql/NewSqlRdf.php +++ b/core/kernel/persistence/newsql/NewSqlRdf.php @@ -1,7 +1,5 @@ operatorEval($firstPart, $secondPart); - } - - //both are vector - elseif ( + } elseif ( + //both are vector $firstPart instanceof core_kernel_classes_ContainerCollection - && $secondPart instanceof core_kernel_classes_ContainerCollection + && $secondPart instanceof core_kernel_classes_ContainerCollection ) { $returnValue = false; foreach ($firstPart->getIterator() as $subLeftPart) { @@ -240,11 +238,10 @@ public function expEval($variable = []) //die("the evaluation is ". $returnValue); //throw new common_Exception('not implemented yet', __FILE__,__LINE__); - } - // first is a vector second is a value - elseif ( - ($firstPart instanceof core_kernel_classes_ContainerCollection) - && ($secondPart instanceof core_kernel_classes_Container) + } elseif ( + // first is a vector second is a value + $firstPart instanceof core_kernel_classes_ContainerCollection + && $secondPart instanceof core_kernel_classes_Container ) { $tempResult = false; foreach ($firstPart->getIterator() as $container) { @@ -265,11 +262,10 @@ public function expEval($variable = []) } } $returnValue = $tempResult; - } - // first is a value second is a vector - elseif ( - ($firstPart instanceof core_kernel_classes_Container) - && ($secondPart instanceof core_kernel_classes_ContainerCollection) + } elseif ( + // first is a value second is a vector + $firstPart instanceof core_kernel_classes_Container + && $secondPart instanceof core_kernel_classes_ContainerCollection ) { foreach ($secondPart->getIterator() as $container) { common_Logger::d('FirstPart Part Container is Second is ContainerCollection', ['Generis Expression']); @@ -279,9 +275,7 @@ public function expEval($variable = []) $tempResult = $tempResult && $this->operatorEval($firstPart, $container); } $returnValue = $tempResult; - } - //case we compare boolean - else { + } else { //case we compare boolean common_Logger::d('Both part are boolean', ['Generis Expression']); switch ($this->getLogicalOperator()->getUri()) { diff --git a/core/kernel/users/interface.UsersManagement.php b/core/kernel/users/interface.UsersManagement.php index bf8e97861..feb945e24 100644 --- a/core/kernel/users/interface.UsersManagement.php +++ b/core/kernel/users/interface.UsersManagement.php @@ -179,4 +179,4 @@ public function getAllowedRoles(); * @return core_kernel_classes_Resource */ public function getDefaultRole(); -} /* end of interface core_kernel_users_UsersManagement */ +} diff --git a/test/bootstrap.php b/test/bootstrap.php index bda80fc12..b0f68373b 100644 --- a/test/bootstrap.php +++ b/test/bootstrap.php @@ -20,6 +20,8 @@ * @license GPLv2 * @package package_name * @subpackage + * + * phpcs:disable PSR1.Files.SideEffects */ $extensionRoot = realpath(__DIR__ . '/../'); diff --git a/test/integration/mutex/test_action.php b/test/integration/mutex/test_action.php index fc8c06439..5dd7a1b06 100644 --- a/test/integration/mutex/test_action.php +++ b/test/integration/mutex/test_action.php @@ -1,5 +1,7 @@ - - Date: Mon, 29 May 2023 12:17:27 +0000 Subject: [PATCH 3/5] chore: apply PSR-12 length fixes for headers --- common/cache/class.Exception.php | 8 ++++++-- common/cache/class.FileCache.php | 9 ++++++--- common/cache/class.KeyValueCache.php | 9 ++++++--- common/cache/class.NotFoundException.php | 8 ++++++-- common/cache/class.PartitionedCachable.php | 9 ++++++--- common/cache/interface.Cache.php | 9 ++++++--- common/class.AjaxResponse.php | 9 ++++++--- common/class.Collection.php | 9 ++++++--- common/class.Exception.php | 9 ++++++--- common/class.Logger.php | 9 ++++++--- common/class.Object.php | 9 ++++++--- common/class.Utils.php | 9 ++++++--- common/configuration/class.BoundableComponent.php | 9 ++++++--- common/configuration/class.Component.php | 9 ++++++--- common/configuration/class.ComponentCollection.php | 9 ++++++--- common/configuration/class.ComponentFactory.php | 9 ++++++--- .../configuration/class.ComponentFactoryException.php | 9 ++++++--- .../configuration/class.CyclicDependencyException.php | 9 ++++++--- common/configuration/class.FileSystemComponent.php | 9 ++++++--- .../configuration/class.MalformedRightsException.php | 9 ++++++--- common/configuration/class.Mock.php | 9 ++++++--- common/configuration/class.PHPDatabaseDriver.php | 9 ++++++--- common/configuration/class.PHPExtension.php | 9 ++++++--- common/configuration/class.PHPINIValue.php | 9 ++++++--- common/configuration/class.PHPRuntime.php | 9 ++++++--- common/configuration/class.Report.php | 9 ++++++--- common/constants.php | 9 ++++++--- common/exception/class.EmptyProperty.php | 9 ++++++--- common/exception/class.Error.php | 9 ++++++--- common/exception/class.FileAlreadyExists.php.php | 9 ++++++--- common/exception/class.FileSystemError.php | 9 ++++++--- common/exception/class.InconsistentData.php | 9 ++++++--- common/exception/class.InvalidArgumentType.php | 9 ++++++--- common/exception/class.IsAjaxAction.php | 9 ++++++--- common/exception/class.SystemUnderMaintenance.php | 9 ++++++--- common/exception/class.UnknownNamespace.php | 9 ++++++--- common/exception/interface.UserReadableException.php | 9 ++++++--- common/ext/class.AbstractExtension.php | 6 ++++-- common/ext/class.AlreadyInstalledException.php | 6 ++++-- common/ext/class.Extension.php | 6 ++++-- common/ext/class.ExtensionException.php | 6 ++++-- common/ext/class.ExtensionHandler.php | 6 ++++-- common/ext/class.ExtensionInstaller.php | 6 ++++-- common/ext/class.ExtensionLoader.php | 6 ++++-- common/ext/class.ExtensionUninstaller.php | 6 ++++-- common/ext/class.ExtensionUpdater.php | 6 ++++-- common/ext/class.ExtensionsManager.php | 6 ++++-- common/ext/class.ForbiddenActionException.php | 6 ++++-- common/ext/class.GenerisInstaller.php | 6 ++++-- common/ext/class.InstallationException.php | 6 ++++-- common/ext/class.Manifest.php | 6 ++++-- common/ext/class.MissingExtensionException.php | 6 ++++-- common/ext/class.Namespace.php | 6 ++++-- common/ext/class.NamespaceManager.php | 6 ++++-- common/http/interface.Credentials.php | 9 ++++++--- common/http/interface.SignatureService.php | 9 ++++++--- common/inc.extension.php | 9 ++++++--- common/interface.Serializable.php | 9 ++++++--- common/log/class.ArchiveFileAppender.php | 9 ++++++--- common/log/class.BaseAppender.php | 9 ++++++--- common/log/class.Dispatcher.php | 9 ++++++--- common/log/class.Item.php | 9 ++++++--- common/log/class.SingleFileAppender.php | 9 ++++++--- common/log/class.UDPAppender.php | 9 ++++++--- common/log/class.XMLAppender.php | 9 ++++++--- common/log/interface.Appender.php | 9 ++++++--- common/log/interface.SeverityLevel.php | 9 ++++++--- .../extension/exception/MalformedManifestException.php | 6 ++++-- .../oatbox/extension/exception/ManifestException.php | 6 ++++-- .../extension/exception/ManifestNotFoundException.php | 6 ++++-- common/uri/class.AbstractUriProvider.php | 9 ++++++--- common/uri/class.MicrotimeUriProvider.php | 9 ++++++--- common/uri/class.UriProviderException.php | 9 ++++++--- common/uri/interface.UriProvider.php | 9 ++++++--- config/sample/generis.conf.php | 9 ++++++--- core/kernel/api/class.ModelFactory.php | 3 ++- core/kernel/api/interface.Api.php | 10 ++++++---- core/kernel/api/interface.ApiModel.php | 9 ++++++--- core/kernel/classes/class.Class.php | 9 ++++++--- core/kernel/classes/class.ClassFactory.php | 9 ++++++--- core/kernel/classes/class.Container.php | 9 ++++++--- core/kernel/classes/class.ContainerCollection.php | 9 ++++++--- core/kernel/classes/class.ContainerComparator.php | 9 ++++++--- core/kernel/classes/class.DbWrapper.php | 9 ++++++--- core/kernel/classes/class.EmptyProperty.php | 9 ++++++--- core/kernel/classes/class.Literal.php | 9 ++++++--- core/kernel/classes/class.Property.php | 9 ++++++--- core/kernel/classes/class.Resource.php | 9 ++++++--- core/kernel/classes/class.ResourceFactory.php | 9 ++++++--- core/kernel/classes/class.Triple.php | 9 ++++++--- core/kernel/impl/class.Api.php | 9 ++++++--- core/kernel/impl/class.ApiModelOO.php | 9 ++++++--- core/kernel/persistence/smoothsql/class.Class.php | 9 ++++++--- core/kernel/persistence/smoothsql/class.Exception.php | 9 ++++++--- core/kernel/persistence/smoothsql/class.Property.php | 9 ++++++--- core/kernel/persistence/smoothsql/class.Resource.php | 9 ++++++--- core/kernel/persistence/smoothsql/class.Utils.php | 9 ++++++--- core/kernel/rules/class.Expression.php | 3 ++- core/kernel/rules/class.ExpressionFactory.php | 3 ++- core/kernel/rules/class.Operation.php | 3 ++- core/kernel/rules/class.OperationFactory.php | 3 ++- core/kernel/rules/class.Rule.php | 3 ++- core/kernel/rules/class.Term.php | 3 ++- core/kernel/rules/class.TermFactory.php | 3 ++- core/kernel/uri/Bin2HexUriProvider.php | 9 ++++++--- core/kernel/uri/MicrotimeRandUriProvider.php | 9 ++++++--- core/kernel/uri/UriProvider.php | 9 ++++++--- core/kernel/uri/UriProviderException.php | 9 ++++++--- core/kernel/uri/class.AdvKeyValueUriProvider.php | 9 ++++++--- core/kernel/uri/class.DatabaseSerialUriProvider.php | 9 ++++++--- core/kernel/users/class.Cache.php | 9 ++++++--- core/kernel/users/class.CacheException.php | 9 ++++++--- core/kernel/users/class.Exception.php | 9 ++++++--- core/kernel/users/class.Service.php | 9 ++++++--- core/kernel/users/interface.RolesManagement.php | 9 ++++++--- core/kernel/users/interface.UsersManagement.php | 9 ++++++--- helpers/class.File.php | 9 ++++++--- helpers/class.VersionedFile.php | 9 ++++++--- test/GenerisPhpUnitTestRunner.php | 6 ++++-- test/config/generis.conf.php | 9 ++++++--- test/integration/ApiModelTest.php | 6 ++++-- test/integration/ClassTest.php | 6 ++++-- test/integration/ConfigurationTest.php | 6 ++++-- test/integration/CreateInstanceTest.php | 6 ++++-- test/integration/DbWrapperTest.php | 6 ++++-- test/integration/ExceptionTest.php | 6 ++++-- test/integration/ModelsRightTest.php | 6 ++++-- test/integration/NamespaceTest.php | 6 ++++-- test/integration/PropertyTest.php | 6 ++++-- test/integration/RdfExportTest.php | 6 ++++-- test/integration/ResourceTest.php | 6 ++++-- test/integration/SqlInjectionTest.php | 6 ++++-- test/integration/UserServiceTest.php | 6 ++++-- .../model/persistence/smoothsql/SmoothsqlUtilsTest.php | 6 ++++-- test/integration/rules/ExpressionFactoryTest.php | 6 ++++-- test/integration/rules/ExpressionTest.php | 6 ++++-- test/integration/rules/OperationFactoryTest.php | 6 ++++-- test/integration/rules/OperationTest.php | 6 ++++-- test/integration/rules/TermFactoryTest.php | 6 ++++-- test/integration/rules/TermTest.php | 6 ++++-- test/samples/manifests/complexManifest.php | 6 ++++-- test/samples/manifests/lightweightManifest.php | 6 ++++-- test/unit/CollectionTest.php | 6 ++++-- test/unit/ConfigurationTest.php | 6 ++++-- test/unit/FileHelperTest.php | 6 ++++-- test/unit/ManifestTest.php | 6 ++++-- test/unit/UtilsTest.php | 6 ++++-- test/unit/oatbox/log/LoggerServiceTest.php | 6 ++++-- 148 files changed, 758 insertions(+), 378 deletions(-) diff --git a/common/cache/class.Exception.php b/common/cache/class.Exception.php index ee72ac0b4..9b77ab092 100644 --- a/common/cache/class.Exception.php +++ b/common/cache/class.Exception.php @@ -15,8 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO & TAO2); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/common/cache/class.FileCache.php b/common/cache/class.FileCache.php index 6940f9e95..bfc83eda8 100644 --- a/common/cache/class.FileCache.php +++ b/common/cache/class.FileCache.php @@ -15,9 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2010-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO & TAO2); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2010-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/common/cache/class.KeyValueCache.php b/common/cache/class.KeyValueCache.php index 5b141a187..b6181749c 100644 --- a/common/cache/class.KeyValueCache.php +++ b/common/cache/class.KeyValueCache.php @@ -15,9 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2010-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO & TAO2); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2010-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/common/cache/class.NotFoundException.php b/common/cache/class.NotFoundException.php index de9e3142e..387662605 100644 --- a/common/cache/class.NotFoundException.php +++ b/common/cache/class.NotFoundException.php @@ -15,8 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO & TAO2); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/common/cache/class.PartitionedCachable.php b/common/cache/class.PartitionedCachable.php index 33d003306..04f7e10f8 100644 --- a/common/cache/class.PartitionedCachable.php +++ b/common/cache/class.PartitionedCachable.php @@ -15,9 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); -* 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO & TAO2); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); +* 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/common/cache/interface.Cache.php b/common/cache/interface.Cache.php index cae38557b..95006e227 100644 --- a/common/cache/interface.Cache.php +++ b/common/cache/interface.Cache.php @@ -15,9 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO & TAO2); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * 2013-2014 (update and modification) Open Assessment Technologies SA; */ diff --git a/common/class.AjaxResponse.php b/common/class.AjaxResponse.php index 37f31046d..542ed22ef 100644 --- a/common/class.AjaxResponse.php +++ b/common/class.AjaxResponse.php @@ -15,9 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO & TAO2); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/common/class.Collection.php b/common/class.Collection.php index f463f4947..e203e5d64 100644 --- a/common/class.Collection.php +++ b/common/class.Collection.php @@ -15,9 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO & TAO2); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/common/class.Exception.php b/common/class.Exception.php index 44a750be4..bdc7e4a96 100644 --- a/common/class.Exception.php +++ b/common/class.Exception.php @@ -15,9 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO & TAO2); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/common/class.Logger.php b/common/class.Logger.php index 23b7d7795..682bd4828 100644 --- a/common/class.Logger.php +++ b/common/class.Logger.php @@ -15,9 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO & TAO2); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * 2013 (update and modification) Open Assessment Technologies SA (under the project TAO-PRODUCT); * */ diff --git a/common/class.Object.php b/common/class.Object.php index 14f0422fa..c507bbdcf 100644 --- a/common/class.Object.php +++ b/common/class.Object.php @@ -15,9 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO & TAO2); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/common/class.Utils.php b/common/class.Utils.php index 8de5bb968..c790d3619 100644 --- a/common/class.Utils.php +++ b/common/class.Utils.php @@ -19,9 +19,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO & TAO2); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/common/configuration/class.BoundableComponent.php b/common/configuration/class.BoundableComponent.php index ee7231378..689b2557c 100644 --- a/common/configuration/class.BoundableComponent.php +++ b/common/configuration/class.BoundableComponent.php @@ -15,9 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO & TAO2); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/common/configuration/class.Component.php b/common/configuration/class.Component.php index 4fafd22d9..be10fac10 100644 --- a/common/configuration/class.Component.php +++ b/common/configuration/class.Component.php @@ -15,9 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO & TAO2); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/common/configuration/class.ComponentCollection.php b/common/configuration/class.ComponentCollection.php index 58bbaf373..3da3754ce 100644 --- a/common/configuration/class.ComponentCollection.php +++ b/common/configuration/class.ComponentCollection.php @@ -15,9 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO & TAO2); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/common/configuration/class.ComponentFactory.php b/common/configuration/class.ComponentFactory.php index 88f61b925..03383d4d8 100644 --- a/common/configuration/class.ComponentFactory.php +++ b/common/configuration/class.ComponentFactory.php @@ -15,9 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO & TAO2); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/common/configuration/class.ComponentFactoryException.php b/common/configuration/class.ComponentFactoryException.php index 45c7a09c6..e4b2a7d1c 100644 --- a/common/configuration/class.ComponentFactoryException.php +++ b/common/configuration/class.ComponentFactoryException.php @@ -15,9 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO & TAO2); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/common/configuration/class.CyclicDependencyException.php b/common/configuration/class.CyclicDependencyException.php index e48f8f125..d1a796747 100644 --- a/common/configuration/class.CyclicDependencyException.php +++ b/common/configuration/class.CyclicDependencyException.php @@ -15,9 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO & TAO2); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/common/configuration/class.FileSystemComponent.php b/common/configuration/class.FileSystemComponent.php index d3638375b..4f769476f 100644 --- a/common/configuration/class.FileSystemComponent.php +++ b/common/configuration/class.FileSystemComponent.php @@ -15,9 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO & TAO2); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/common/configuration/class.MalformedRightsException.php b/common/configuration/class.MalformedRightsException.php index 8bed9bb74..f71834172 100644 --- a/common/configuration/class.MalformedRightsException.php +++ b/common/configuration/class.MalformedRightsException.php @@ -15,9 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO & TAO2); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/common/configuration/class.Mock.php b/common/configuration/class.Mock.php index c98e3a20c..daca452f3 100644 --- a/common/configuration/class.Mock.php +++ b/common/configuration/class.Mock.php @@ -15,9 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO & TAO2); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/common/configuration/class.PHPDatabaseDriver.php b/common/configuration/class.PHPDatabaseDriver.php index f4b1564a1..cba6658de 100644 --- a/common/configuration/class.PHPDatabaseDriver.php +++ b/common/configuration/class.PHPDatabaseDriver.php @@ -15,9 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO & TAO2); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/common/configuration/class.PHPExtension.php b/common/configuration/class.PHPExtension.php index a7ac41700..896ade397 100644 --- a/common/configuration/class.PHPExtension.php +++ b/common/configuration/class.PHPExtension.php @@ -15,9 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO & TAO2); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/common/configuration/class.PHPINIValue.php b/common/configuration/class.PHPINIValue.php index 8c12d728a..f6c9bdfb5 100644 --- a/common/configuration/class.PHPINIValue.php +++ b/common/configuration/class.PHPINIValue.php @@ -15,9 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO & TAO2); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/common/configuration/class.PHPRuntime.php b/common/configuration/class.PHPRuntime.php index 1ef97e7b6..4a2a93217 100644 --- a/common/configuration/class.PHPRuntime.php +++ b/common/configuration/class.PHPRuntime.php @@ -15,9 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO & TAO2); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/common/configuration/class.Report.php b/common/configuration/class.Report.php index 2868a5fae..80205ea24 100644 --- a/common/configuration/class.Report.php +++ b/common/configuration/class.Report.php @@ -15,9 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO & TAO2); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/common/constants.php b/common/constants.php index a3acf7a64..48c448d0c 100644 --- a/common/constants.php +++ b/common/constants.php @@ -15,9 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO & TAO2); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * 2017 (update and modification) Open Assessment Technologies SA (under the project TAO-PRODUCT); */ diff --git a/common/exception/class.EmptyProperty.php b/common/exception/class.EmptyProperty.php index 6d6f4a141..2154e119c 100644 --- a/common/exception/class.EmptyProperty.php +++ b/common/exception/class.EmptyProperty.php @@ -15,9 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO & TAO2); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/common/exception/class.Error.php b/common/exception/class.Error.php index fa7c6c7bf..8fc7398fd 100644 --- a/common/exception/class.Error.php +++ b/common/exception/class.Error.php @@ -15,9 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO & TAO2); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/common/exception/class.FileAlreadyExists.php.php b/common/exception/class.FileAlreadyExists.php.php index 0a43f780a..c1a0a97a3 100644 --- a/common/exception/class.FileAlreadyExists.php.php +++ b/common/exception/class.FileAlreadyExists.php.php @@ -15,9 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO & TAO2); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/common/exception/class.FileSystemError.php b/common/exception/class.FileSystemError.php index 7b1800a3f..27544d622 100644 --- a/common/exception/class.FileSystemError.php +++ b/common/exception/class.FileSystemError.php @@ -15,9 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO & TAO2); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/common/exception/class.InconsistentData.php b/common/exception/class.InconsistentData.php index 493f1fe0d..b3bdfe6f6 100644 --- a/common/exception/class.InconsistentData.php +++ b/common/exception/class.InconsistentData.php @@ -15,9 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO & TAO2); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/common/exception/class.InvalidArgumentType.php b/common/exception/class.InvalidArgumentType.php index b95ec8888..f6d21efc0 100644 --- a/common/exception/class.InvalidArgumentType.php +++ b/common/exception/class.InvalidArgumentType.php @@ -15,9 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO & TAO2); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/common/exception/class.IsAjaxAction.php b/common/exception/class.IsAjaxAction.php index d54931543..dec3fa30d 100644 --- a/common/exception/class.IsAjaxAction.php +++ b/common/exception/class.IsAjaxAction.php @@ -15,9 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO & TAO2); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/common/exception/class.SystemUnderMaintenance.php b/common/exception/class.SystemUnderMaintenance.php index f984fc003..4dbb76574 100644 --- a/common/exception/class.SystemUnderMaintenance.php +++ b/common/exception/class.SystemUnderMaintenance.php @@ -15,9 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO & TAO2); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/common/exception/class.UnknownNamespace.php b/common/exception/class.UnknownNamespace.php index 68037d00c..3d059bc28 100644 --- a/common/exception/class.UnknownNamespace.php +++ b/common/exception/class.UnknownNamespace.php @@ -15,9 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO & TAO2); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/common/exception/interface.UserReadableException.php b/common/exception/interface.UserReadableException.php index 08ce360d9..6e4fa08ff 100644 --- a/common/exception/interface.UserReadableException.php +++ b/common/exception/interface.UserReadableException.php @@ -15,9 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO & TAO2); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/common/ext/class.AbstractExtension.php b/common/ext/class.AbstractExtension.php index 0986a80d2..b4e33a554 100644 --- a/common/ext/class.AbstractExtension.php +++ b/common/ext/class.AbstractExtension.php @@ -15,8 +15,10 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/common/ext/class.AlreadyInstalledException.php b/common/ext/class.AlreadyInstalledException.php index 6331ad4e8..5925a1bb5 100644 --- a/common/ext/class.AlreadyInstalledException.php +++ b/common/ext/class.AlreadyInstalledException.php @@ -15,8 +15,10 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/common/ext/class.Extension.php b/common/ext/class.Extension.php index 9519dfbc5..945d725da 100755 --- a/common/ext/class.Extension.php +++ b/common/ext/class.Extension.php @@ -15,8 +15,10 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * 2013-2014 (update and modification) Open Assessment Technologies SA; * */ diff --git a/common/ext/class.ExtensionException.php b/common/ext/class.ExtensionException.php index bc22cd1a2..187665b72 100644 --- a/common/ext/class.ExtensionException.php +++ b/common/ext/class.ExtensionException.php @@ -15,8 +15,10 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/common/ext/class.ExtensionHandler.php b/common/ext/class.ExtensionHandler.php index 194fe9889..5e8f6735d 100644 --- a/common/ext/class.ExtensionHandler.php +++ b/common/ext/class.ExtensionHandler.php @@ -18,8 +18,10 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/common/ext/class.ExtensionInstaller.php b/common/ext/class.ExtensionInstaller.php index 50fd46cee..1fc21cba1 100755 --- a/common/ext/class.ExtensionInstaller.php +++ b/common/ext/class.ExtensionInstaller.php @@ -15,8 +15,10 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/common/ext/class.ExtensionLoader.php b/common/ext/class.ExtensionLoader.php index e21a8ab57..c48db1809 100644 --- a/common/ext/class.ExtensionLoader.php +++ b/common/ext/class.ExtensionLoader.php @@ -15,8 +15,10 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/common/ext/class.ExtensionUninstaller.php b/common/ext/class.ExtensionUninstaller.php index c9740daf2..bfb53ebd7 100755 --- a/common/ext/class.ExtensionUninstaller.php +++ b/common/ext/class.ExtensionUninstaller.php @@ -17,8 +17,10 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/common/ext/class.ExtensionUpdater.php b/common/ext/class.ExtensionUpdater.php index f699ed62d..f723f30d2 100644 --- a/common/ext/class.ExtensionUpdater.php +++ b/common/ext/class.ExtensionUpdater.php @@ -15,8 +15,10 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/common/ext/class.ExtensionsManager.php b/common/ext/class.ExtensionsManager.php index 12997f88a..eeeaa41c3 100755 --- a/common/ext/class.ExtensionsManager.php +++ b/common/ext/class.ExtensionsManager.php @@ -15,8 +15,10 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/common/ext/class.ForbiddenActionException.php b/common/ext/class.ForbiddenActionException.php index 4910cdd1f..1fd1d0225 100644 --- a/common/ext/class.ForbiddenActionException.php +++ b/common/ext/class.ForbiddenActionException.php @@ -15,8 +15,10 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/common/ext/class.GenerisInstaller.php b/common/ext/class.GenerisInstaller.php index 7a6ab40d5..62354afbc 100644 --- a/common/ext/class.GenerisInstaller.php +++ b/common/ext/class.GenerisInstaller.php @@ -15,8 +15,10 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * 2013-2020 (update and modification) Open Assessment Technologies SA; * */ diff --git a/common/ext/class.InstallationException.php b/common/ext/class.InstallationException.php index 302b93d26..4a88eda51 100644 --- a/common/ext/class.InstallationException.php +++ b/common/ext/class.InstallationException.php @@ -15,8 +15,10 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/common/ext/class.Manifest.php b/common/ext/class.Manifest.php index 084952e94..5d007f28e 100755 --- a/common/ext/class.Manifest.php +++ b/common/ext/class.Manifest.php @@ -15,8 +15,10 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/common/ext/class.MissingExtensionException.php b/common/ext/class.MissingExtensionException.php index ecf00e674..d000ccb58 100644 --- a/common/ext/class.MissingExtensionException.php +++ b/common/ext/class.MissingExtensionException.php @@ -15,8 +15,10 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/common/ext/class.Namespace.php b/common/ext/class.Namespace.php index 9b4fb1c6f..ad482bfbd 100644 --- a/common/ext/class.Namespace.php +++ b/common/ext/class.Namespace.php @@ -15,8 +15,10 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/common/ext/class.NamespaceManager.php b/common/ext/class.NamespaceManager.php index 438668377..40edc2d00 100644 --- a/common/ext/class.NamespaceManager.php +++ b/common/ext/class.NamespaceManager.php @@ -15,8 +15,10 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * 2013 (update and modification) Open Assessment Technologies SA (under the project TAO-PRODUCT); * */ diff --git a/common/http/interface.Credentials.php b/common/http/interface.Credentials.php index 01185c86b..abedf022c 100755 --- a/common/http/interface.Credentials.php +++ b/common/http/interface.Credentials.php @@ -15,9 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO & TAO2); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * 2013 (update and modification) Open Assessment Technologies SA (under the project TAO-PRODUCT); * */ diff --git a/common/http/interface.SignatureService.php b/common/http/interface.SignatureService.php index e98b98690..432516678 100755 --- a/common/http/interface.SignatureService.php +++ b/common/http/interface.SignatureService.php @@ -15,9 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO & TAO2); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * 2013 (update and modification) Open Assessment Technologies SA (under the project TAO-PRODUCT); * */ diff --git a/common/inc.extension.php b/common/inc.extension.php index 47f27a60d..56c92bd36 100644 --- a/common/inc.extension.php +++ b/common/inc.extension.php @@ -15,9 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO & TAO2); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/common/interface.Serializable.php b/common/interface.Serializable.php index b91f1ab26..b763b1993 100644 --- a/common/interface.Serializable.php +++ b/common/interface.Serializable.php @@ -15,9 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO & TAO2); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/common/log/class.ArchiveFileAppender.php b/common/log/class.ArchiveFileAppender.php index d40fc6e16..a879db82e 100644 --- a/common/log/class.ArchiveFileAppender.php +++ b/common/log/class.ArchiveFileAppender.php @@ -15,9 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO & TAO2); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/common/log/class.BaseAppender.php b/common/log/class.BaseAppender.php index b6a636420..917f1d0b7 100644 --- a/common/log/class.BaseAppender.php +++ b/common/log/class.BaseAppender.php @@ -15,9 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO & TAO2); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/common/log/class.Dispatcher.php b/common/log/class.Dispatcher.php index c80ea7a01..e43d5b98e 100644 --- a/common/log/class.Dispatcher.php +++ b/common/log/class.Dispatcher.php @@ -15,9 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO & TAO2); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/common/log/class.Item.php b/common/log/class.Item.php index d389a7df5..82e6b2932 100644 --- a/common/log/class.Item.php +++ b/common/log/class.Item.php @@ -15,9 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO & TAO2); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * 2013 (update and modification) Open Assessment Technologies SA (under the project TAO-PRODUCT); * */ diff --git a/common/log/class.SingleFileAppender.php b/common/log/class.SingleFileAppender.php index 670039458..f0c0f8d39 100644 --- a/common/log/class.SingleFileAppender.php +++ b/common/log/class.SingleFileAppender.php @@ -15,9 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO & TAO2); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * 2013 (update and modification) Open Assessment Technologies SA (under the project TAO-PRODUCT); * */ diff --git a/common/log/class.UDPAppender.php b/common/log/class.UDPAppender.php index 09a12d48e..d16a81005 100644 --- a/common/log/class.UDPAppender.php +++ b/common/log/class.UDPAppender.php @@ -15,9 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO & TAO2); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/common/log/class.XMLAppender.php b/common/log/class.XMLAppender.php index b398d001d..3a91eb80b 100644 --- a/common/log/class.XMLAppender.php +++ b/common/log/class.XMLAppender.php @@ -15,9 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO & TAO2); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * 2013 (update and modification) Open Assessment Technologies SA (under the project TAO-PRODUCT); * */ diff --git a/common/log/interface.Appender.php b/common/log/interface.Appender.php index f0cef44d6..8ccd8cb5e 100644 --- a/common/log/interface.Appender.php +++ b/common/log/interface.Appender.php @@ -15,9 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO & TAO2); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/common/log/interface.SeverityLevel.php b/common/log/interface.SeverityLevel.php index 2dba1a595..46d5ed643 100644 --- a/common/log/interface.SeverityLevel.php +++ b/common/log/interface.SeverityLevel.php @@ -15,9 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO & TAO2); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/common/oatbox/extension/exception/MalformedManifestException.php b/common/oatbox/extension/exception/MalformedManifestException.php index ce1b3fcc7..a13764073 100644 --- a/common/oatbox/extension/exception/MalformedManifestException.php +++ b/common/oatbox/extension/exception/MalformedManifestException.php @@ -15,8 +15,10 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/common/oatbox/extension/exception/ManifestException.php b/common/oatbox/extension/exception/ManifestException.php index b826e6d1a..9e808a496 100644 --- a/common/oatbox/extension/exception/ManifestException.php +++ b/common/oatbox/extension/exception/ManifestException.php @@ -15,8 +15,10 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/common/oatbox/extension/exception/ManifestNotFoundException.php b/common/oatbox/extension/exception/ManifestNotFoundException.php index b3ae35326..5b03e4fa3 100644 --- a/common/oatbox/extension/exception/ManifestNotFoundException.php +++ b/common/oatbox/extension/exception/ManifestNotFoundException.php @@ -15,8 +15,10 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/common/uri/class.AbstractUriProvider.php b/common/uri/class.AbstractUriProvider.php index b95179d89..dd9fbc5d0 100644 --- a/common/uri/class.AbstractUriProvider.php +++ b/common/uri/class.AbstractUriProvider.php @@ -15,9 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO & TAO2); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/common/uri/class.MicrotimeUriProvider.php b/common/uri/class.MicrotimeUriProvider.php index 77eeb414c..c2a20c579 100644 --- a/common/uri/class.MicrotimeUriProvider.php +++ b/common/uri/class.MicrotimeUriProvider.php @@ -15,9 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO & TAO2); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/common/uri/class.UriProviderException.php b/common/uri/class.UriProviderException.php index 7c02b8373..c80d383c0 100644 --- a/common/uri/class.UriProviderException.php +++ b/common/uri/class.UriProviderException.php @@ -15,9 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO & TAO2); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/common/uri/interface.UriProvider.php b/common/uri/interface.UriProvider.php index 273c76ac1..0951ae9d0 100644 --- a/common/uri/interface.UriProvider.php +++ b/common/uri/interface.UriProvider.php @@ -15,9 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO & TAO2); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/config/sample/generis.conf.php b/config/sample/generis.conf.php index 722ee73b6..f2970df69 100644 --- a/config/sample/generis.conf.php +++ b/config/sample/generis.conf.php @@ -15,9 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO & TAO2); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/core/kernel/api/class.ModelFactory.php b/core/kernel/api/class.ModelFactory.php index 23f045c50..c395b035f 100644 --- a/core/kernel/api/class.ModelFactory.php +++ b/core/kernel/api/class.ModelFactory.php @@ -73,7 +73,8 @@ public function createModel($namespace, $data) private function addStatement($modelId, $subject, $predicate, $object, $lang = null) { $result = core_kernel_classes_DbWrapper::singleton()->query( - 'SELECT count(*) FROM statements WHERE modelid = ? AND subject = ? AND predicate = ? AND object = ? AND l_language = ?', + 'SELECT count(*) FROM statements WHERE modelid = ? AND subject = ? AND predicate = ? ' + . 'AND object = ? AND l_language = ?', [$modelId, $subject, $predicate, $object, (is_null($lang)) ? '' : $lang] ); diff --git a/core/kernel/api/interface.Api.php b/core/kernel/api/interface.Api.php index 5f7a00380..e702fd564 100644 --- a/core/kernel/api/interface.Api.php +++ b/core/kernel/api/interface.Api.php @@ -15,10 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); - * + * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO & TAO2); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); */ /** diff --git a/core/kernel/api/interface.ApiModel.php b/core/kernel/api/interface.ApiModel.php index a8d86fa79..f70c893b4 100644 --- a/core/kernel/api/interface.ApiModel.php +++ b/core/kernel/api/interface.ApiModel.php @@ -15,9 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO & TAO2); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/core/kernel/classes/class.Class.php b/core/kernel/classes/class.Class.php index a0cd4c268..36a9b3c8b 100644 --- a/core/kernel/classes/class.Class.php +++ b/core/kernel/classes/class.Class.php @@ -15,9 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO & TAO2); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * 2017-2021 (update and modification) Open Assessment Technologies SA. */ diff --git a/core/kernel/classes/class.ClassFactory.php b/core/kernel/classes/class.ClassFactory.php index 9eab30039..38dc8014c 100644 --- a/core/kernel/classes/class.ClassFactory.php +++ b/core/kernel/classes/class.ClassFactory.php @@ -15,9 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO & TAO2); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * 2017 (update and modification) Open Assessment Technologies SA (under the project TAO-PRODUCT); */ diff --git a/core/kernel/classes/class.Container.php b/core/kernel/classes/class.Container.php index 84aca3ada..a996828ea 100644 --- a/core/kernel/classes/class.Container.php +++ b/core/kernel/classes/class.Container.php @@ -15,9 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO & TAO2); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/core/kernel/classes/class.ContainerCollection.php b/core/kernel/classes/class.ContainerCollection.php index 62e432cec..6dd6524a6 100644 --- a/core/kernel/classes/class.ContainerCollection.php +++ b/core/kernel/classes/class.ContainerCollection.php @@ -15,9 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO & TAO2); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/core/kernel/classes/class.ContainerComparator.php b/core/kernel/classes/class.ContainerComparator.php index 4660c7ba0..a44726e5a 100644 --- a/core/kernel/classes/class.ContainerComparator.php +++ b/core/kernel/classes/class.ContainerComparator.php @@ -15,9 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO & TAO2); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/core/kernel/classes/class.DbWrapper.php b/core/kernel/classes/class.DbWrapper.php index 4f93387cd..167d948bc 100644 --- a/core/kernel/classes/class.DbWrapper.php +++ b/core/kernel/classes/class.DbWrapper.php @@ -15,9 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO & TAO2); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/core/kernel/classes/class.EmptyProperty.php b/core/kernel/classes/class.EmptyProperty.php index 0d2eebb04..b01c947a1 100755 --- a/core/kernel/classes/class.EmptyProperty.php +++ b/core/kernel/classes/class.EmptyProperty.php @@ -15,9 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO & TAO2); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/core/kernel/classes/class.Literal.php b/core/kernel/classes/class.Literal.php index 2c3ba60c2..eb56b58e2 100644 --- a/core/kernel/classes/class.Literal.php +++ b/core/kernel/classes/class.Literal.php @@ -15,9 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO & TAO2); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/core/kernel/classes/class.Property.php b/core/kernel/classes/class.Property.php index f75aa4f96..326e8dc4c 100644 --- a/core/kernel/classes/class.Property.php +++ b/core/kernel/classes/class.Property.php @@ -15,9 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO & TAO2); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/core/kernel/classes/class.Resource.php b/core/kernel/classes/class.Resource.php index bf1760aeb..88f9115ca 100644 --- a/core/kernel/classes/class.Resource.php +++ b/core/kernel/classes/class.Resource.php @@ -15,9 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO & TAO2); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * 2017-2021 (update and modification) Open Assessment Technologies SA; */ diff --git a/core/kernel/classes/class.ResourceFactory.php b/core/kernel/classes/class.ResourceFactory.php index 30a533a1d..53063adb1 100644 --- a/core/kernel/classes/class.ResourceFactory.php +++ b/core/kernel/classes/class.ResourceFactory.php @@ -15,9 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO & TAO2); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * 2017 (update and modification) Open Assessment Technologies SA (under the project TAO-PRODUCT); */ diff --git a/core/kernel/classes/class.Triple.php b/core/kernel/classes/class.Triple.php index 1db533a07..92d2b9c24 100644 --- a/core/kernel/classes/class.Triple.php +++ b/core/kernel/classes/class.Triple.php @@ -15,9 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO & TAO2); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/core/kernel/impl/class.Api.php b/core/kernel/impl/class.Api.php index 17a8f58a4..b80873dbd 100644 --- a/core/kernel/impl/class.Api.php +++ b/core/kernel/impl/class.Api.php @@ -15,9 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO & TAO2); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * 2017 (update and modification) Open Assessment Technologies SA (under the project TAO-PRODUCT); */ diff --git a/core/kernel/impl/class.ApiModelOO.php b/core/kernel/impl/class.ApiModelOO.php index 69fe32068..0185dc044 100644 --- a/core/kernel/impl/class.ApiModelOO.php +++ b/core/kernel/impl/class.ApiModelOO.php @@ -15,9 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO & TAO2); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * 2017 (update and modification) Open Assessment Technologies SA (under the project TAO-PRODUCT); */ diff --git a/core/kernel/persistence/smoothsql/class.Class.php b/core/kernel/persistence/smoothsql/class.Class.php index 2699ec423..d33556356 100644 --- a/core/kernel/persistence/smoothsql/class.Class.php +++ b/core/kernel/persistence/smoothsql/class.Class.php @@ -15,9 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO & TAO2); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * 2012-2017 (update and modification) Open Assessment Technologies SA (under the project TAO-PRODUCT); */ diff --git a/core/kernel/persistence/smoothsql/class.Exception.php b/core/kernel/persistence/smoothsql/class.Exception.php index 63ff991b5..8c12abcf9 100644 --- a/core/kernel/persistence/smoothsql/class.Exception.php +++ b/core/kernel/persistence/smoothsql/class.Exception.php @@ -15,9 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO & TAO2); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/core/kernel/persistence/smoothsql/class.Property.php b/core/kernel/persistence/smoothsql/class.Property.php index 8e8a5f22e..b4fa6d6b1 100644 --- a/core/kernel/persistence/smoothsql/class.Property.php +++ b/core/kernel/persistence/smoothsql/class.Property.php @@ -15,9 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO & TAO2); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * 2017 (update and modification) Open Assessment Technologies SA (under the project TAO-PRODUCT); */ diff --git a/core/kernel/persistence/smoothsql/class.Resource.php b/core/kernel/persistence/smoothsql/class.Resource.php index c9dab97c1..00c209297 100644 --- a/core/kernel/persistence/smoothsql/class.Resource.php +++ b/core/kernel/persistence/smoothsql/class.Resource.php @@ -15,9 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO & TAO2); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * 2017 (update and modification) Open Assessment Technologies SA (under the project TAO-PRODUCT); */ diff --git a/core/kernel/persistence/smoothsql/class.Utils.php b/core/kernel/persistence/smoothsql/class.Utils.php index 039ae9240..a7140f89b 100644 --- a/core/kernel/persistence/smoothsql/class.Utils.php +++ b/core/kernel/persistence/smoothsql/class.Utils.php @@ -15,9 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO & TAO2); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * 2012-2017 (update and modification) Open Assessment Technologies SA (under the project TAO-PRODUCT); */ diff --git a/core/kernel/rules/class.Expression.php b/core/kernel/rules/class.Expression.php index d38ead8fa..94fe3d064 100644 --- a/core/kernel/rules/class.Expression.php +++ b/core/kernel/rules/class.Expression.php @@ -16,7 +16,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * Copyright (c) 2007-2010 (original work) Public Research Centre Henri Tudor & University of Luxembourg) (under the project TAO-QUAL); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); * 2017 (update and modification) Open Assessment Technologies SA (under the project TAO-PRODUCT); * */ diff --git a/core/kernel/rules/class.ExpressionFactory.php b/core/kernel/rules/class.ExpressionFactory.php index 714b9d83f..49880077d 100644 --- a/core/kernel/rules/class.ExpressionFactory.php +++ b/core/kernel/rules/class.ExpressionFactory.php @@ -16,7 +16,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * Copyright (c) 2007-2010 (original work) Public Research Centre Henri Tudor & University of Luxembourg) (under the project TAO-QUAL); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); * 2017 (update and modification) Open Assessment Technologies SA (under the project TAO-PRODUCT); * */ diff --git a/core/kernel/rules/class.Operation.php b/core/kernel/rules/class.Operation.php index 47fdd9531..31a504df5 100644 --- a/core/kernel/rules/class.Operation.php +++ b/core/kernel/rules/class.Operation.php @@ -16,7 +16,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * Copyright (c) 2007-2010 (original work) Public Research Centre Henri Tudor & University of Luxembourg) (under the project TAO-QUAL); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); * 2017 (update and modification) Open Assessment Technologies SA (under the project TAO-PRODUCT) * */ diff --git a/core/kernel/rules/class.OperationFactory.php b/core/kernel/rules/class.OperationFactory.php index 95c924ccf..69f4a8c95 100644 --- a/core/kernel/rules/class.OperationFactory.php +++ b/core/kernel/rules/class.OperationFactory.php @@ -16,7 +16,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * Copyright (c) 2007-2010 (original work) Public Research Centre Henri Tudor & University of Luxembourg) (under the project TAO-QUAL); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); * 2017 (update and modification) Open Assessment Technologies SA (under the project TAO-PRODUCT); * * diff --git a/core/kernel/rules/class.Rule.php b/core/kernel/rules/class.Rule.php index e972a9875..34285aeb3 100644 --- a/core/kernel/rules/class.Rule.php +++ b/core/kernel/rules/class.Rule.php @@ -16,7 +16,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * Copyright (c) 2007-2010 (original work) Public Research Centre Henri Tudor & University of Luxembourg) (under the project TAO-QUAL); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); * 2017 (update and modification) Open Assessment Technologies SA (under the project TAO-PRODUCT); */ diff --git a/core/kernel/rules/class.Term.php b/core/kernel/rules/class.Term.php index 410ba8e63..772a41cb7 100644 --- a/core/kernel/rules/class.Term.php +++ b/core/kernel/rules/class.Term.php @@ -16,7 +16,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * Copyright (c) 2007-2010 (original work) Public Research Centre Henri Tudor & University of Luxembourg) (under the project TAO-QUAL); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); * 2017 (update and modification) Open Assessment Technologies SA (under the project TAO-PRODUCT); */ diff --git a/core/kernel/rules/class.TermFactory.php b/core/kernel/rules/class.TermFactory.php index f92b7bcc5..4a3602889 100644 --- a/core/kernel/rules/class.TermFactory.php +++ b/core/kernel/rules/class.TermFactory.php @@ -16,7 +16,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * Copyright (c) 2007-2010 (original work) Public Research Centre Henri Tudor & University of Luxembourg) (under the project TAO-QUAL); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); * 2017 (update and modification) Open Assessment Technologies SA (under the project TAO-PRODUCT); */ diff --git a/core/kernel/uri/Bin2HexUriProvider.php b/core/kernel/uri/Bin2HexUriProvider.php index 2a76d37c1..ce8300ec4 100644 --- a/core/kernel/uri/Bin2HexUriProvider.php +++ b/core/kernel/uri/Bin2HexUriProvider.php @@ -15,9 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO & TAO2); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * 2013 (update and modification) Open Assessment Technologies SA; */ diff --git a/core/kernel/uri/MicrotimeRandUriProvider.php b/core/kernel/uri/MicrotimeRandUriProvider.php index 5a9ed97a1..60fb94b19 100644 --- a/core/kernel/uri/MicrotimeRandUriProvider.php +++ b/core/kernel/uri/MicrotimeRandUriProvider.php @@ -15,9 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO & TAO2); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * 2013 (update and modification) Open Assessment Technologies SA; */ diff --git a/core/kernel/uri/UriProvider.php b/core/kernel/uri/UriProvider.php index 17b557d29..6abde1808 100644 --- a/core/kernel/uri/UriProvider.php +++ b/core/kernel/uri/UriProvider.php @@ -15,9 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO & TAO2); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/core/kernel/uri/UriProviderException.php b/core/kernel/uri/UriProviderException.php index af190a6d0..07ec95418 100644 --- a/core/kernel/uri/UriProviderException.php +++ b/core/kernel/uri/UriProviderException.php @@ -15,9 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO & TAO2); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/core/kernel/uri/class.AdvKeyValueUriProvider.php b/core/kernel/uri/class.AdvKeyValueUriProvider.php index 7880fc710..b4b9cf469 100755 --- a/core/kernel/uri/class.AdvKeyValueUriProvider.php +++ b/core/kernel/uri/class.AdvKeyValueUriProvider.php @@ -15,9 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO & TAO2); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/core/kernel/uri/class.DatabaseSerialUriProvider.php b/core/kernel/uri/class.DatabaseSerialUriProvider.php index ccc8c5396..cd2d25c3f 100644 --- a/core/kernel/uri/class.DatabaseSerialUriProvider.php +++ b/core/kernel/uri/class.DatabaseSerialUriProvider.php @@ -15,9 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO & TAO2); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/core/kernel/users/class.Cache.php b/core/kernel/users/class.Cache.php index 978d9e8e7..9b9470f7d 100644 --- a/core/kernel/users/class.Cache.php +++ b/core/kernel/users/class.Cache.php @@ -15,9 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO & TAO2); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/core/kernel/users/class.CacheException.php b/core/kernel/users/class.CacheException.php index 63dab0ddd..0e120a4bb 100644 --- a/core/kernel/users/class.CacheException.php +++ b/core/kernel/users/class.CacheException.php @@ -15,9 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO & TAO2); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/core/kernel/users/class.Exception.php b/core/kernel/users/class.Exception.php index d91d1a7a3..68a2d0c54 100644 --- a/core/kernel/users/class.Exception.php +++ b/core/kernel/users/class.Exception.php @@ -15,9 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO & TAO2); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/core/kernel/users/class.Service.php b/core/kernel/users/class.Service.php index 7d0cffef2..cf6bff0b2 100644 --- a/core/kernel/users/class.Service.php +++ b/core/kernel/users/class.Service.php @@ -15,9 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO & TAO2); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * 2017 (update and modification) Open Assessment Technologies SA (under the project TAO-PRODUCT); */ diff --git a/core/kernel/users/interface.RolesManagement.php b/core/kernel/users/interface.RolesManagement.php index 7d6fab435..c76defad8 100644 --- a/core/kernel/users/interface.RolesManagement.php +++ b/core/kernel/users/interface.RolesManagement.php @@ -15,9 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO & TAO2); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/core/kernel/users/interface.UsersManagement.php b/core/kernel/users/interface.UsersManagement.php index feb945e24..f1374ab5e 100644 --- a/core/kernel/users/interface.UsersManagement.php +++ b/core/kernel/users/interface.UsersManagement.php @@ -15,9 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO & TAO2); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/helpers/class.File.php b/helpers/class.File.php index 7ee097967..fc9fead3e 100644 --- a/helpers/class.File.php +++ b/helpers/class.File.php @@ -15,9 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO & TAO2); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * 2013 (update and modification) Open Assessment Technologies SA (under the project TAO-PRODUCT); * */ diff --git a/helpers/class.VersionedFile.php b/helpers/class.VersionedFile.php index fdfd1c9aa..4c20e9c26 100644 --- a/helpers/class.VersionedFile.php +++ b/helpers/class.VersionedFile.php @@ -15,9 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO & TAO2); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/test/GenerisPhpUnitTestRunner.php b/test/GenerisPhpUnitTestRunner.php index 370629766..85afc3a42 100755 --- a/test/GenerisPhpUnitTestRunner.php +++ b/test/GenerisPhpUnitTestRunner.php @@ -15,8 +15,10 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/test/config/generis.conf.php b/test/config/generis.conf.php index 528b7e1a8..fd48ecfd5 100644 --- a/test/config/generis.conf.php +++ b/test/config/generis.conf.php @@ -15,9 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); - * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO & TAO2); + * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/test/integration/ApiModelTest.php b/test/integration/ApiModelTest.php index d7817d5df..460e14603 100755 --- a/test/integration/ApiModelTest.php +++ b/test/integration/ApiModelTest.php @@ -15,8 +15,10 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * 2017 ((update and modification) Open Assessment Technologies SA (under the project TAO-PRODUCT); */ diff --git a/test/integration/ClassTest.php b/test/integration/ClassTest.php index 55d713249..b82b1b3e8 100755 --- a/test/integration/ClassTest.php +++ b/test/integration/ClassTest.php @@ -15,8 +15,10 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * 2017 (update and modification) Open Assessment Technologies SA (under the project TAO-PRODUCT); */ diff --git a/test/integration/ConfigurationTest.php b/test/integration/ConfigurationTest.php index bf337f862..1f964d300 100755 --- a/test/integration/ConfigurationTest.php +++ b/test/integration/ConfigurationTest.php @@ -15,8 +15,10 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/test/integration/CreateInstanceTest.php b/test/integration/CreateInstanceTest.php index 1c1893009..ae4331909 100755 --- a/test/integration/CreateInstanceTest.php +++ b/test/integration/CreateInstanceTest.php @@ -15,8 +15,10 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * 2017 (update and modification) Open Assessment Technologies SA (under the project TAO-PRODUCT); */ diff --git a/test/integration/DbWrapperTest.php b/test/integration/DbWrapperTest.php index 8c512cf7d..b3bd008b4 100755 --- a/test/integration/DbWrapperTest.php +++ b/test/integration/DbWrapperTest.php @@ -15,8 +15,10 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * 2013 (update and modification) Open Assessment Technologies SA (under the project TAO-PRODUCT); * */ diff --git a/test/integration/ExceptionTest.php b/test/integration/ExceptionTest.php index 956bfdd49..46b9974a6 100755 --- a/test/integration/ExceptionTest.php +++ b/test/integration/ExceptionTest.php @@ -15,8 +15,10 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/test/integration/ModelsRightTest.php b/test/integration/ModelsRightTest.php index a4ac47a79..482c5fc68 100755 --- a/test/integration/ModelsRightTest.php +++ b/test/integration/ModelsRightTest.php @@ -15,8 +15,10 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * 2017 (update and modification) Open Assessment Technologies SA (under the project TAO-PRODUCT); */ diff --git a/test/integration/NamespaceTest.php b/test/integration/NamespaceTest.php index 1549e6b8c..3037b9359 100755 --- a/test/integration/NamespaceTest.php +++ b/test/integration/NamespaceTest.php @@ -15,8 +15,10 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * 2017 (update and modification) Open Assessment Technologies SA; * */ diff --git a/test/integration/PropertyTest.php b/test/integration/PropertyTest.php index 1f77c9ca4..0fece31ba 100755 --- a/test/integration/PropertyTest.php +++ b/test/integration/PropertyTest.php @@ -15,8 +15,10 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * 2017 (update and modification) Open Assessment Technologies SA (under the project TAO-PRODUCT); */ diff --git a/test/integration/RdfExportTest.php b/test/integration/RdfExportTest.php index e111aa2bf..1cd25c701 100755 --- a/test/integration/RdfExportTest.php +++ b/test/integration/RdfExportTest.php @@ -15,8 +15,10 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * 2012-2014 (update and modification) Open Assessment Technologies SA (under the project TAO-PRODUCT); */ diff --git a/test/integration/ResourceTest.php b/test/integration/ResourceTest.php index 7c345e99f..a5191ca0a 100755 --- a/test/integration/ResourceTest.php +++ b/test/integration/ResourceTest.php @@ -15,8 +15,10 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * 2017 (update and modification) Open Assessment Technologies SA (under the project TAO-PRODUCT); */ diff --git a/test/integration/SqlInjectionTest.php b/test/integration/SqlInjectionTest.php index 40e834530..2ef35d0a2 100644 --- a/test/integration/SqlInjectionTest.php +++ b/test/integration/SqlInjectionTest.php @@ -15,8 +15,10 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * 2017 (update and modification) Open Assessment Technologies SA (under the project TAO-PRODUCT); */ diff --git a/test/integration/UserServiceTest.php b/test/integration/UserServiceTest.php index 31bfe5065..f4fc2fd84 100755 --- a/test/integration/UserServiceTest.php +++ b/test/integration/UserServiceTest.php @@ -15,8 +15,10 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * 2012-2017 (update and modification) Open Assessment Technologies SA (under the project TAO-PRODUCT); */ diff --git a/test/integration/model/persistence/smoothsql/SmoothsqlUtilsTest.php b/test/integration/model/persistence/smoothsql/SmoothsqlUtilsTest.php index 63a20e61f..dd75fd0f0 100644 --- a/test/integration/model/persistence/smoothsql/SmoothsqlUtilsTest.php +++ b/test/integration/model/persistence/smoothsql/SmoothsqlUtilsTest.php @@ -15,8 +15,10 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * 2012-2014 (update and modification) 2012-2014 (update and modification) Open Assessment Technologies SA (under the project TAO-PRODUCT); * */ diff --git a/test/integration/rules/ExpressionFactoryTest.php b/test/integration/rules/ExpressionFactoryTest.php index b29e1fd12..fa9711666 100644 --- a/test/integration/rules/ExpressionFactoryTest.php +++ b/test/integration/rules/ExpressionFactoryTest.php @@ -15,8 +15,10 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * 2017 (update and modification) Open Assessment Technologies SA (under the project TAO-PRODUCT); */ diff --git a/test/integration/rules/ExpressionTest.php b/test/integration/rules/ExpressionTest.php index 221de6745..b8d1d3825 100644 --- a/test/integration/rules/ExpressionTest.php +++ b/test/integration/rules/ExpressionTest.php @@ -15,8 +15,10 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * 2017 (update and modification) Open Assessment Technologies SA; * */ diff --git a/test/integration/rules/OperationFactoryTest.php b/test/integration/rules/OperationFactoryTest.php index 953203754..784df1285 100644 --- a/test/integration/rules/OperationFactoryTest.php +++ b/test/integration/rules/OperationFactoryTest.php @@ -15,8 +15,10 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * 2017 (update and modification) Open Assessment Technologies SA (under the project TAO-PRODUCT); */ diff --git a/test/integration/rules/OperationTest.php b/test/integration/rules/OperationTest.php index 04a4d9680..1b1fb1263 100644 --- a/test/integration/rules/OperationTest.php +++ b/test/integration/rules/OperationTest.php @@ -15,8 +15,10 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * 2017 (update and modification) Open Assessment Technologies SA (under the project TAO-PRODUCT); */ diff --git a/test/integration/rules/TermFactoryTest.php b/test/integration/rules/TermFactoryTest.php index 58cf71def..0c74ebb5e 100644 --- a/test/integration/rules/TermFactoryTest.php +++ b/test/integration/rules/TermFactoryTest.php @@ -15,8 +15,10 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * 2017 (update and modification) Open Assessment Technologies SA (under the project TAO-PRODUCT); */ diff --git a/test/integration/rules/TermTest.php b/test/integration/rules/TermTest.php index 24f9b97ec..ee706be75 100644 --- a/test/integration/rules/TermTest.php +++ b/test/integration/rules/TermTest.php @@ -15,8 +15,10 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * 2017 (update and modification) Open Assessment Technologies SA (under the project TAO-PRODUCT); */ diff --git a/test/samples/manifests/complexManifest.php b/test/samples/manifests/complexManifest.php index 92899adca..92585b34c 100644 --- a/test/samples/manifests/complexManifest.php +++ b/test/samples/manifests/complexManifest.php @@ -15,8 +15,10 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/test/samples/manifests/lightweightManifest.php b/test/samples/manifests/lightweightManifest.php index f85382988..9298c9ea3 100644 --- a/test/samples/manifests/lightweightManifest.php +++ b/test/samples/manifests/lightweightManifest.php @@ -15,8 +15,10 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/test/unit/CollectionTest.php b/test/unit/CollectionTest.php index d1207f3cb..d779db2db 100755 --- a/test/unit/CollectionTest.php +++ b/test/unit/CollectionTest.php @@ -15,8 +15,10 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/test/unit/ConfigurationTest.php b/test/unit/ConfigurationTest.php index 632ac9b87..4b19f3c55 100755 --- a/test/unit/ConfigurationTest.php +++ b/test/unit/ConfigurationTest.php @@ -15,8 +15,10 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/test/unit/FileHelperTest.php b/test/unit/FileHelperTest.php index 3d59b4bc3..b20465ccb 100755 --- a/test/unit/FileHelperTest.php +++ b/test/unit/FileHelperTest.php @@ -15,8 +15,10 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * 2017 (update and modification) Open Assessment Technologies SA; * */ diff --git a/test/unit/ManifestTest.php b/test/unit/ManifestTest.php index 809f8e1ac..b39bd8224 100755 --- a/test/unit/ManifestTest.php +++ b/test/unit/ManifestTest.php @@ -15,8 +15,10 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * 2017 (update and modification) Open Assessment Technologies SA; * */ diff --git a/test/unit/UtilsTest.php b/test/unit/UtilsTest.php index 37c0a23e1..6e00852c8 100755 --- a/test/unit/UtilsTest.php +++ b/test/unit/UtilsTest.php @@ -15,8 +15,10 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ diff --git a/test/unit/oatbox/log/LoggerServiceTest.php b/test/unit/oatbox/log/LoggerServiceTest.php index 9b940eef6..c516f3e5d 100755 --- a/test/unit/oatbox/log/LoggerServiceTest.php +++ b/test/unit/oatbox/log/LoggerServiceTest.php @@ -15,8 +15,10 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); - * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); + * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung + * (under the project TAO-TRANSFER); + * 2009-2012 (update and modification) Public Research Centre Henri Tudor + * (under the project TAO-SUSTAIN & TAO-DEV); * */ From b7b6a3bc27afeab2f5e3c1fbc2ef1a96be5be945 Mon Sep 17 00:00:00 2001 From: Andrei Shapiro Date: Tue, 30 May 2023 08:21:25 +0000 Subject: [PATCH 4/5] chore: apply PSR-12 manual fixes --- common/class.Logger.php | 5 +- common/log/class.Item.php | 12 +- common/user/auth/class.Service.php | 7 +- common/user/class.User.php | 6 +- core/GenerisRdf.php | 1 + core/kernel/classes/class.Class.php | 23 +- core/kernel/classes/class.ClassFactory.php | 9 +- core/kernel/classes/class.ClassIterator.php | 9 +- .../classes/class.ContainerCollection.php | 6 +- core/kernel/classes/class.DbWrapper.php | 8 +- .../class.MultiplePropertyValuesException.php | 5 +- core/kernel/classes/class.Resource.php | 28 ++- .../classes/class.ResourceFormatter.php | 4 +- .../kernel/classes/class.ResourceIterator.php | 3 +- core/kernel/impl/class.ApiModelOO.php | 4 +- .../persistence/interface.ClassInterface.php | 14 +- .../interface.ResourceInterface.php | 39 +++- core/kernel/persistence/newsql/NewSqlRdf.php | 3 +- .../persistence/smoothsql/class.Class.php | 96 ++++++-- .../persistence/smoothsql/class.Property.php | 13 +- .../persistence/smoothsql/class.Resource.php | 79 +++++-- .../smoothsql/class.SmoothModel.php | 12 +- .../persistence/smoothsql/class.SmoothRdf.php | 10 +- .../persistence/smoothsql/class.Utils.php | 41 +++- .../smoothsql/search/ComplexSearchService.php | 14 +- .../smoothsql/search/QueryJoiner.php | 209 ++++++++++-------- .../kernel/persistence/wrapper/RdfWrapper.php | 13 +- core/kernel/rules/class.Expression.php | 21 +- core/kernel/rules/class.ExpressionFactory.php | 20 +- core/kernel/rules/class.Operation.php | 10 +- core/kernel/rules/class.OperationFactory.php | 10 +- core/kernel/rules/class.Rule.php | 8 +- core/kernel/rules/class.Term.php | 22 +- core/kernel/rules/class.TermFactory.php | 8 +- core/kernel/uri/Bin2HexUriProvider.php | 3 +- core/kernel/uri/MicrotimeRandUriProvider.php | 12 +- .../uri/class.DatabaseSerialUriProvider.php | 12 +- core/kernel/users/class.AuthAdapter.php | 8 +- core/kernel/users/class.Cache.php | 3 +- core/kernel/users/class.Service.php | 44 ++-- .../users/interface.RolesManagement.php | 8 +- core/user/AuthAdapter.php | 16 +- test/GenerisPhpUnitTestRunner.php | 4 +- test/OntologyMockTrait.php | 4 +- test/integration/ClassTest.php | 56 ++++- test/integration/ComplexSearchTest.php | 4 +- test/integration/CreateInstanceTest.php | 29 ++- test/integration/DbWrapperTest.php | 15 +- test/integration/RdfExportTest.php | 5 +- test/integration/ResourceTest.php | 45 +++- test/integration/SqlInjectionTest.php | 5 +- test/integration/UserServiceTest.php | 18 +- .../filesystem/DirectoryFilesystemTest.php | 4 +- .../FileSerializerMigrationHelperTest.php | 8 +- test/integration/helpers/FileTest.php | 8 +- .../model/persistence/file/FileModelTest.php | 5 +- .../smoothsql/SmoothsqlUtilsTest.php | 95 ++++++-- test/integration/mutex/LockServiceTest.php | 30 ++- .../rules/ExpressionFactoryTest.php | 16 +- test/integration/rules/ExpressionTest.php | 180 ++++++++++++--- test/integration/rules/TermFactoryTest.php | 5 +- test/integration/rules/TermTest.php | 5 +- test/samples/manifests/complexManifest.php | 19 +- test/unit/ConfigurationTest.php | 16 +- test/unit/FileHelperTest.php | 11 +- test/unit/ManifestTest.php | 8 +- test/unit/UtilsTest.php | 19 +- .../configuration/ComponentFactoryTest.php | 25 ++- .../configuration/FileSystemComponentTest.php | 9 +- .../AdvKeyValuePersistenceTest.php | 25 ++- test/unit/helpers/FileTest.php | 21 +- .../model/data/permission/FreeAccessTest.php | 10 +- .../data/permission/IntersectionTest.php | 25 ++- .../persistence/newsql/NewSqlRdfTest.php | 3 +- .../persistence/smoothsql/SmoothRdfTest.php | 6 +- test/unit/oatbox/mutex/LockServiceTest.php | 39 +++- .../service/EnvironmentVariableTest.php | 5 +- 77 files changed, 1265 insertions(+), 395 deletions(-) diff --git a/common/class.Logger.php b/common/class.Logger.php index 682bd4828..0560c0f79 100644 --- a/common/class.Logger.php +++ b/common/class.Logger.php @@ -466,8 +466,9 @@ public function handlePHPShutdown() if ($error !== null && ($error['type'] & (E_COMPILE_ERROR | E_ERROR | E_PARSE | E_CORE_ERROR)) !== 0) { $msg = (isset($error['file'], $error['line'])) - ? 'php error(' . $error['type'] . ') in ' . $error['file'] . '@' . $error['line'] . ': ' . $error['message'] - : 'php error(' . $error['type'] . '): ' . $error['message']; + ? 'php error(' . $error['type'] . ') in ' . $error['file'] . '@' . $error['line'] . ': ' + . $error['message'] + : 'php error(' . $error['type'] . '): ' . $error['message']; self::singleton()->log(self::FATAL_LEVEL, $msg, ['PHPERROR']); } } diff --git a/common/log/class.Item.php b/common/log/class.Item.php index 82e6b2932..09a1e6a4e 100644 --- a/common/log/class.Item.php +++ b/common/log/class.Item.php @@ -115,8 +115,16 @@ class common_log_Item * @param int errorLine * @return mixed */ - public function __construct($description, $severity, $datetime, $backtrace = [], $tags = [], $request = "", $errorFile = '', $errorLine = 0) - { + public function __construct( + $description, + $severity, + $datetime, + $backtrace = [], + $tags = [], + $request = "", + $errorFile = '', + $errorLine = 0 + ) { if (!is_string($description)) { throw new InvalidArgumentException("The description must be a string, " . gettype($description) . " given"); } diff --git a/common/user/auth/class.Service.php b/common/user/auth/class.Service.php index 5f9ec8991..da973561e 100755 --- a/common/user/auth/class.Service.php +++ b/common/user/auth/class.Service.php @@ -67,9 +67,10 @@ private function __construct() * * @access public * @author Jerome Bogaerts, - * @param string login The login of the user. - * @param string password the md5 hash of the password. - * @param allowedRoles A Role or an array of Roles that are allowed to be logged in. If the user has a Role that matches one or more Roles in this array, the login request will be accepted. + * @param string $login The login of the user. + * @param string $password the md5 hash of the password. + * @param $allowedRoles - A Role or an array of Roles that are allowed to be logged in. If the user has a Role that + * matches one or more Roles in this array, the login request will be accepted. * @return boolean */ public function login(common_user_auth_Adapter $adapter, $allowedRoles = []) diff --git a/common/user/class.User.php b/common/user/class.User.php index a21c61db1..11607e9b2 100755 --- a/common/user/class.User.php +++ b/common/user/class.User.php @@ -58,7 +58,11 @@ public function getRoles() // We use a Depth First Search approach to flatten the Roles Graph. foreach ($this->getPropertyValues(GenerisRdf::PROPERTY_USER_ROLES) as $roleUri) { $returnValue[] = $roleUri; - foreach (core_kernel_users_Service::singleton()->getIncludedRoles(new core_kernel_classes_Resource($roleUri)) as $role) { + $includedRoles = core_kernel_users_Service::singleton()->getIncludedRoles( + new core_kernel_classes_Resource($roleUri) + ); + + foreach ($includedRoles as $role) { $returnValue[] = $role->getUri(); } } diff --git a/core/GenerisRdf.php b/core/GenerisRdf.php index 80c21a1e9..c222b9fa1 100644 --- a/core/GenerisRdf.php +++ b/core/GenerisRdf.php @@ -17,6 +17,7 @@ * * Copyright (c) 2017 (original work) Open Assessment Technologies SA; * + * phpcs:disable Generic.Files.LineLength */ namespace oat\generis\model; diff --git a/core/kernel/classes/class.Class.php b/core/kernel/classes/class.Class.php index 36a9b3c8b..aa6bd9f49 100644 --- a/core/kernel/classes/class.Class.php +++ b/core/kernel/classes/class.Class.php @@ -357,9 +357,17 @@ public function countInstances($propertyFilters = [], $options = []) * @param array options * @return \core_kernel_classes_Resource[] */ - public function getInstancesPropertyValues(core_kernel_classes_Property $property, $propertyFilters = [], $options = []) - { - return (array) $this->getImplementation()->getInstancesPropertyValues($this, $property, $propertyFilters, $options); + public function getInstancesPropertyValues( + core_kernel_classes_Property $property, + $propertyFilters = [], + $options = [] + ) { + return (array) $this->getImplementation()->getInstancesPropertyValues( + $this, + $property, + $propertyFilters, + $options + ); } /** @@ -394,7 +402,9 @@ public function createInstanceWithProperties($properties) $additionalTypes = []; if (isset($properties[OntologyRdf::RDF_TYPE])) { - $types = is_array($properties[OntologyRdf::RDF_TYPE]) ? $properties[OntologyRdf::RDF_TYPE] : [$properties[OntologyRdf::RDF_TYPE]]; + $types = is_array($properties[OntologyRdf::RDF_TYPE]) + ? $properties[OntologyRdf::RDF_TYPE] + : [$properties[OntologyRdf::RDF_TYPE]]; foreach ($types as $type) { $uri = is_object($type) ? $type->getUri() : $type; if ($uri != $this->getUri()) { @@ -418,8 +428,9 @@ public function createInstanceWithProperties($properties) * * @access public * @author Jerome Bogaerts, - * @param array resources An array of core_kernel_classes_Resource or URIs. - * @param boolean deleteReference If set to true, references about the resources will also be deleted from the database. + * @param array $resources An array of core_kernel_classes_Resource or URIs. + * @param boolean $deleteReference If set to true, references about the resources will also be deleted from the + * database. * @return boolean */ public function deleteInstances($resources, $deleteReference = false) diff --git a/core/kernel/classes/class.ClassFactory.php b/core/kernel/classes/class.ClassFactory.php index 38dc8014c..a34f57dff 100644 --- a/core/kernel/classes/class.ClassFactory.php +++ b/core/kernel/classes/class.ClassFactory.php @@ -95,8 +95,13 @@ public static function createInstance(core_kernel_classes_Class $clazz, $label = * @param string uri * @return core_kernel_classes_Property */ - public static function createProperty(core_kernel_classes_Class $clazz, $label = '', $comment = '', $isLgDependent = false, $uri = '') - { + public static function createProperty( + core_kernel_classes_Class $clazz, + $label = '', + $comment = '', + $isLgDependent = false, + $uri = '' + ) { $returnValue = null; $property = new core_kernel_classes_Class(OntologyRdf::RDF_PROPERTY); $propertyInstance = self::createInstance($property, $label, $comment, $uri); diff --git a/core/kernel/classes/class.ClassIterator.php b/core/kernel/classes/class.ClassIterator.php index 88a54639b..dcff257cf 100644 --- a/core/kernel/classes/class.ClassIterator.php +++ b/core/kernel/classes/class.ClassIterator.php @@ -47,7 +47,9 @@ public function __construct($classes) { $classes = is_array($classes) ? $classes : [$classes]; foreach ($classes as $class) { - $this->todoClasses[] = (is_object($class) && $class instanceof core_kernel_classes_Class) ? $class->getUri() : $class; + $this->todoClasses[] = (is_object($class) && $class instanceof core_kernel_classes_Class) + ? $class->getUri() + : $class; } $this->rewind(); } @@ -92,7 +94,10 @@ public function next() $this->classes[] = $newUri; $class = new \core_kernel_classes_Class($newUri); foreach ($class->getSubClasses(false) as $subClass) { - if (!in_array($subClass->getUri(), $this->classes) && !in_array($subClass->getUri(), $this->todoClasses)) { + if ( + !in_array($subClass->getUri(), $this->classes) + && !in_array($subClass->getUri(), $this->todoClasses) + ) { $this->todoClasses[] = $subClass->getUri(); } } diff --git a/core/kernel/classes/class.ContainerCollection.php b/core/kernel/classes/class.ContainerCollection.php index 6dd6524a6..50a47cac8 100644 --- a/core/kernel/classes/class.ContainerCollection.php +++ b/core/kernel/classes/class.ContainerCollection.php @@ -90,7 +90,11 @@ public function intersect(common_Collection $collection) $returnValue = new core_kernel_classes_ContainerCollection(new common_Object(__METHOD__)); - $returnValue->sequence = array_uintersect($this->sequence, $collection->sequence, 'core_kernel_classes_ContainerComparator::compare'); + $returnValue->sequence = array_uintersect( + $this->sequence, + $collection->sequence, + 'core_kernel_classes_ContainerComparator::compare' + ); return $returnValue; diff --git a/core/kernel/classes/class.DbWrapper.php b/core/kernel/classes/class.DbWrapper.php index 167d948bc..f34ee6072 100644 --- a/core/kernel/classes/class.DbWrapper.php +++ b/core/kernel/classes/class.DbWrapper.php @@ -422,9 +422,11 @@ public function getColumnNotFoundErrorCode() * @abstract * @access public * @author Jerome Bogaerts, - * @param string indexName The name of the index to create. - * @param string tableName A table name - * @param array columns An associative array that represents the columns on which the index applies. The keys of the array are the name of the columns, the values are the length of the data to index in the column. If there is no length limitation, set the value of the array cell to null. + * @param string $indexName The name of the index to create. + * @param string $tableName A table name + * @param array $columns An associative array that represents the columns on which the index applies. The keys of + * the array are the name of the columns, the values are the length of the data to index in + * the column. If there is no length limitation, set the value of the array cell to null. * @return void */ public function createIndex($indexName, $tableName, $columns) diff --git a/core/kernel/classes/class.MultiplePropertyValuesException.php b/core/kernel/classes/class.MultiplePropertyValuesException.php index dee557684..f30a87bef 100644 --- a/core/kernel/classes/class.MultiplePropertyValuesException.php +++ b/core/kernel/classes/class.MultiplePropertyValuesException.php @@ -56,7 +56,10 @@ public function __construct(core_kernel_classes_Resource $resource, core_kernel_ $this->resource = $resource; $this->property = $property; - parent::__construct('Property ( ' . $property->getUri() . ' ) of resource ' . ' ( ' . $resource->getUri() . ' ) has more than one value do not use getUniquePropertyValue but use getPropertyValue instead'); + parent::__construct( + 'Property ( ' . $property->getUri() . ' ) of resource ' . ' ( ' . $resource->getUri() + . ' ) has more than one value do not use getUniquePropertyValue but use getPropertyValue instead' + ); } /** diff --git a/core/kernel/classes/class.Resource.php b/core/kernel/classes/class.Resource.php index 88f9115ca..148e24b25 100644 --- a/core/kernel/classes/class.Resource.php +++ b/core/kernel/classes/class.Resource.php @@ -109,10 +109,15 @@ private function getImplementation() public function __construct($uri, $debug = '') { if (empty($uri)) { - throw new common_exception_Error('cannot construct the resource because the uri cannot be empty, debug: ' . $debug); + throw new common_exception_Error( + 'cannot construct the resource because the uri cannot be empty, debug: ' . $debug + ); } if (!is_string($uri) && !$uri instanceof self) { - throw new common_exception_Error('could not create resource from ' . (is_object($uri) ? get_class($uri) : gettype($uri)) . ' debug: ' . $debug); + throw new common_exception_Error( + 'could not create resource from ' . (is_object($uri) ? get_class($uri) : gettype($uri)) + . ' debug: ' . $debug + ); } $this->uriResource = $uri instanceof self ? $uri->getUri() : $uri; } @@ -126,7 +131,9 @@ public function __construct($uri, $debug = '') */ public function __clone() { - throw new common_exception_DeprecatedApiMethod('Use duplicated instead, because clone resource could not share same uri that original'); + throw new common_exception_DeprecatedApiMethod( + 'Use duplicated instead, because clone resource could not share same uri that original' + ); } public function isCustom(): bool @@ -196,7 +203,8 @@ public function isProperty() * Returns all the types of this resource as core_kernel_classes_Class objects. * * @author Joel Bout - * @return core_kernel_classes_Class[] An associative array where keys are class URIs and values are core_kernel_classes_Class objects. + * @return core_kernel_classes_Class[] An associative array where keys are class URIs and values are + * core_kernel_classes_Class objects. */ public function getTypes() { @@ -287,8 +295,9 @@ public function setComment($comment) * * @access public * @author Joel Bout, - * @param Property property uriProperty is string and may be short in the case of a locally defined property (module namespace), or long uri - * @param array options + * @param core_kernel_classes_Property $property uriProperty is string and may be short in the case of a locally + * defined property (module namespace), or long uri + * @param array $options * @return array */ public function getPropertyValues(core_kernel_classes_Property $property, $options = []) @@ -358,7 +367,9 @@ public function getOnePropertyValue(core_kernel_classes_Property $property, $las { $returnValue = null; if ($last) { - throw new core_kernel_persistence_Exception('parameter \'last\' for getOnePropertyValue no longer supported'); + throw new core_kernel_persistence_Exception( + 'parameter \'last\' for getOnePropertyValue no longer supported' + ); }; $options = [ @@ -595,7 +606,8 @@ public function duplicate($excludedProperties = []) * * @author patrick.plichart@tudor.lu * - * @param bool deleteReference set deleteReference to true when you need that all reference to this resource are removed. + * @param bool $deleteReference set deleteReference to true when you need that all reference to this resource are + * removed. * * @return bool */ diff --git a/core/kernel/classes/class.ResourceFormatter.php b/core/kernel/classes/class.ResourceFormatter.php index 7274b198e..0e8ab32ca 100644 --- a/core/kernel/classes/class.ResourceFormatter.php +++ b/core/kernel/classes/class.ResourceFormatter.php @@ -72,7 +72,9 @@ private function propertiesValuestoStdClasses($propertiesValues = null) foreach ($values as $value) { $stdValue = new stdClass(); $stdValue->valueType = (get_class($value) == "core_kernel_classes_Literal") ? "literal" : "resource"; - $stdValue->value = (get_class($value) == "core_kernel_classes_Literal") ? $value->__toString() : $value->getUri(); + $stdValue->value = (get_class($value) == "core_kernel_classes_Literal") + ? $value->__toString() + : $value->getUri(); $propStdClass->values[] = $stdValue; } $returnValue[] = $propStdClass; diff --git a/core/kernel/classes/class.ResourceIterator.php b/core/kernel/classes/class.ResourceIterator.php index 8cad087f1..262ba509f 100644 --- a/core/kernel/classes/class.ResourceIterator.php +++ b/core/kernel/classes/class.ResourceIterator.php @@ -117,7 +117,8 @@ public function next() $this->currentInstance++; if (!isset($this->instanceCache[$this->currentInstance])) { // try to load next block (unless we know it's empty) - $remainingInstances = !$this->endOfClass && $this->load($this->classIterator->current(), $this->currentInstance); + $remainingInstances = !$this->endOfClass + && $this->load($this->classIterator->current(), $this->currentInstance); // endOfClass or failed loading if (!$remainingInstances) { diff --git a/core/kernel/impl/class.ApiModelOO.php b/core/kernel/impl/class.ApiModelOO.php index 0185dc044..639c87ce6 100644 --- a/core/kernel/impl/class.ApiModelOO.php +++ b/core/kernel/impl/class.ApiModelOO.php @@ -253,7 +253,9 @@ public function setStatement($subject, $predicate, $object, $language) ]); } catch (DBALException $e) { if ($e->getCode() !== '00000') { - throw new common_Exception("Unable to setStatement (SPO) {$subject}, {$predicate}, {$object} : " . $e->getMessage()); + throw new common_Exception( + "Unable to setStatement (SPO) {$subject}, {$predicate}, {$object} : " . $e->getMessage() + ); } } diff --git a/core/kernel/persistence/interface.ClassInterface.php b/core/kernel/persistence/interface.ClassInterface.php index 3227476ab..bcb6c253f 100644 --- a/core/kernel/persistence/interface.ClassInterface.php +++ b/core/kernel/persistence/interface.ClassInterface.php @@ -144,7 +144,12 @@ public function createSubClass(core_kernel_classes_Class $resource, $label = '', * @param boolean isLgDependent * @return core_kernel_classes_Property */ - public function createProperty(core_kernel_classes_Class $resource, $label = '', $comment = '', $isLgDependent = false); + public function createProperty( + core_kernel_classes_Class $resource, + $label = '', + $comment = '', + $isLgDependent = false + ); /** * Short description of method searchInstances @@ -181,7 +186,12 @@ public function countInstances(core_kernel_classes_Class $resource, $propertyFil * @param array options * @return array */ - public function getInstancesPropertyValues(core_kernel_classes_Class $resource, core_kernel_classes_Property $property, $propertyFilters = [], $options = []); + public function getInstancesPropertyValues( + core_kernel_classes_Class $resource, + core_kernel_classes_Property $property, + $propertyFilters = [], + $options = [] + ); /** * Should not be called by application code, please use diff --git a/core/kernel/persistence/interface.ResourceInterface.php b/core/kernel/persistence/interface.ResourceInterface.php index 8639df093..c577aafd9 100644 --- a/core/kernel/persistence/interface.ResourceInterface.php +++ b/core/kernel/persistence/interface.ResourceInterface.php @@ -52,7 +52,11 @@ public function getTypes(core_kernel_classes_Resource $resource); * @param array options * @return array */ - public function getPropertyValues(core_kernel_classes_Resource $resource, core_kernel_classes_Property $property, $options = []); + public function getPropertyValues( + core_kernel_classes_Resource $resource, + core_kernel_classes_Property $property, + $options = [] + ); /** * Short description of method getPropertyValuesByLg @@ -64,7 +68,11 @@ public function getPropertyValues(core_kernel_classes_Resource $resource, core_k * @param string lg * @return core_kernel_classes_ContainerCollection */ - public function getPropertyValuesByLg(core_kernel_classes_Resource $resource, core_kernel_classes_Property $property, $lg); + public function getPropertyValuesByLg( + core_kernel_classes_Resource $resource, + core_kernel_classes_Property $property, + $lg + ); /** * Short description of method setPropertyValue @@ -77,7 +85,12 @@ public function getPropertyValuesByLg(core_kernel_classes_Resource $resource, co * @param string lg * @return boolean */ - public function setPropertyValue(core_kernel_classes_Resource $resource, core_kernel_classes_Property $property, $object, $lg = null); + public function setPropertyValue( + core_kernel_classes_Resource $resource, + core_kernel_classes_Property $property, + $object, + $lg = null + ); /** * Short description of method setPropertiesValues @@ -101,7 +114,12 @@ public function setPropertiesValues(core_kernel_classes_Resource $resource, $pro * @param string lg * @return boolean */ - public function setPropertyValueByLg(core_kernel_classes_Resource $resource, core_kernel_classes_Property $property, $value, $lg); + public function setPropertyValueByLg( + core_kernel_classes_Resource $resource, + core_kernel_classes_Property $property, + $value, + $lg + ); /** * Short description of method removePropertyValues @@ -113,7 +131,11 @@ public function setPropertyValueByLg(core_kernel_classes_Resource $resource, cor * @param array options * @return boolean */ - public function removePropertyValues(core_kernel_classes_Resource $resource, core_kernel_classes_Property $property, $options = []); + public function removePropertyValues( + core_kernel_classes_Resource $resource, + core_kernel_classes_Property $property, + $options = [] + ); /** * Short description of method removePropertyValueByLg @@ -126,7 +148,12 @@ public function removePropertyValues(core_kernel_classes_Resource $resource, cor * @param array options * @return boolean */ - public function removePropertyValueByLg(core_kernel_classes_Resource $resource, core_kernel_classes_Property $property, $lg, $options = []); + public function removePropertyValueByLg( + core_kernel_classes_Resource $resource, + core_kernel_classes_Property $property, + $lg, + $options = [] + ); /** * Short description of method getRdfTriples diff --git a/core/kernel/persistence/newsql/NewSqlRdf.php b/core/kernel/persistence/newsql/NewSqlRdf.php index 5fa5d63ae..e655ed8a7 100644 --- a/core/kernel/persistence/newsql/NewSqlRdf.php +++ b/core/kernel/persistence/newsql/NewSqlRdf.php @@ -43,7 +43,8 @@ class NewSqlRdf extends core_kernel_persistence_smoothsql_SmoothRdf public function add(core_kernel_classes_Triple $triple) { - $query = 'INSERT INTO statements ( id, modelId, subject, predicate, object, l_language, epoch, author) VALUES ( ?, ? , ? , ? , ? , ? , ?, ?);'; + $query = 'INSERT INTO statements ( id, modelId, subject, predicate, object, l_language, epoch, author) VALUES ' + . '( ?, ? , ? , ? , ? , ? , ?, ?);'; $success = $this->getPersistence() ->exec( diff --git a/core/kernel/persistence/smoothsql/class.Class.php b/core/kernel/persistence/smoothsql/class.Class.php index d33556356..b27762948 100644 --- a/core/kernel/persistence/smoothsql/class.Class.php +++ b/core/kernel/persistence/smoothsql/class.Class.php @@ -37,7 +37,8 @@ * Short description of class core_kernel_persistence_smoothsql_Class * */ -class core_kernel_persistence_smoothsql_Class extends core_kernel_persistence_smoothsql_Resource implements core_kernel_persistence_ClassInterface +class core_kernel_persistence_smoothsql_Class extends core_kernel_persistence_smoothsql_Resource implements + core_kernel_persistence_ClassInterface { use EventManagerAwareTrait; @@ -49,8 +50,12 @@ public function getSubClasses(core_kernel_classes_Class $resource, $recursive = { if (!$recursive) { $returnValue = []; - $sqlQuery = 'SELECT subject FROM statements WHERE predicate = ? and ' . $this->getPersistence()->getPlatForm()->getObjectTypeCondition() . ' = ?'; - $sqlResult = $this->getPersistence()->query($sqlQuery, [OntologyRdfs::RDFS_SUBCLASSOF, $resource->getUri()]); + $sqlQuery = 'SELECT subject FROM statements WHERE predicate = ? and ' + . $this->getPersistence()->getPlatForm()->getObjectTypeCondition() . ' = ?'; + $sqlResult = $this->getPersistence()->query( + $sqlQuery, + [OntologyRdfs::RDFS_SUBCLASSOF, $resource->getUri()] + ); while ($row = $sqlResult->fetch()) { $returnValue[$row['subject']] = $this->getModel()->getClass($row['subject']); } @@ -74,8 +79,9 @@ private function getRecursiveSubClasses(core_kernel_classes_Class $resource) foreach ($todo as $class) { $classString .= ", " . $this->getPersistence()->quote($class->getUri()) ; } - $sqlQuery = 'SELECT subject FROM statements WHERE predicate = ? and ' . $this->getPersistence()->getPlatForm()->getObjectTypeCondition() - . ' in (' . substr($classString, 1) . ')'; + $sqlQuery = 'SELECT subject FROM statements WHERE predicate = ? and ' + . $this->getPersistence()->getPlatForm()->getObjectTypeCondition() . ' in (' + . substr($classString, 1) . ')'; $sqlResult = $this->getPersistence()->query($sqlQuery, [OntologyRdfs::RDFS_SUBCLASSOF]); $todo = []; while ($row = $sqlResult->fetch()) { @@ -97,7 +103,8 @@ public function isSubClassOf(core_kernel_classes_Class $resource, core_kernel_cl { $returnValue = false; - $query = 'SELECT object FROM statements WHERE subject = ? AND predicate = ? AND ' . $this->getPersistence()->getPlatForm()->getObjectTypeCondition() . ' = ?'; + $query = 'SELECT object FROM statements WHERE subject = ? AND predicate = ? AND ' + . $this->getPersistence()->getPlatForm()->getObjectTypeCondition() . ' = ?'; $result = $this->getPersistence()->query($query, [ $resource->getUri(), OntologyRdfs::RDFS_SUBCLASSOF, @@ -138,9 +145,15 @@ public function getParentClasses(core_kernel_classes_Class $resource, $recursive $parentClass = $this->getModel()->getClass($row['object']); $returnValue[$parentClass->getUri()] = $parentClass ; - if ($recursive == true && $parentClass->getUri() != OntologyRdfs::RDFS_CLASS && $parentClass->getUri() != OntologyRdfs::RDFS_RESOURCE) { + if ( + $recursive == true + && $parentClass->getUri() != OntologyRdfs::RDFS_CLASS + && $parentClass->getUri() != OntologyRdfs::RDFS_RESOURCE + ) { if ($parentClass->getUri() == GenerisRdf::CLASS_GENERIS_RESOURCE) { - $returnValue[OntologyRdfs::RDFS_RESOURCE] = $this->getModel()->getClass(OntologyRdfs::RDFS_RESOURCE); + $returnValue[OntologyRdfs::RDFS_RESOURCE] = $this->getModel()->getClass( + OntologyRdfs::RDFS_RESOURCE + ); } else { $plop = $parentClass->getParentClasses(true); $returnValue = array_merge($returnValue, $plop); @@ -159,7 +172,8 @@ public function getProperties(core_kernel_classes_Class $resource, $recursive = { $returnValue = []; - $sqlQuery = 'SELECT subject FROM statements WHERE predicate = ? AND ' . $this->getPersistence()->getPlatForm()->getObjectTypeCondition() . ' = ?'; + $sqlQuery = 'SELECT subject FROM statements WHERE predicate = ? AND ' + . $this->getPersistence()->getPlatForm()->getObjectTypeCondition() . ' = ?'; $sqlResult = $this->getPersistence()->query($sqlQuery, [ OntologyRdfs::RDFS_DOMAIN, $resource->getUri() @@ -316,8 +330,12 @@ public function createSubClass(core_kernel_classes_Class $resource, $label = '', * (non-PHPdoc) * @see core_kernel_persistence_ClassInterface::createProperty() */ - public function createProperty(core_kernel_classes_Class $resource, $label = '', $comment = '', $isLgDependent = false) - { + public function createProperty( + core_kernel_classes_Class $resource, + $label = '', + $comment = '', + $isLgDependent = false + ) { $returnValue = null; @@ -387,7 +405,8 @@ public function countInstances(core_kernel_classes_Class $resource, $propertyFil unset($options['order']); } - $query = 'SELECT count(subject) FROM (' . $this->getFilteredQuery($resource, $propertyFilters, $options) . ') as countq'; + $query = 'SELECT count(subject) FROM (' . $this->getFilteredQuery($resource, $propertyFilters, $options) + . ') as countq'; return (int)$this->getPersistence()->query($query)->fetchColumn(); } @@ -395,8 +414,12 @@ public function countInstances(core_kernel_classes_Class $resource, $propertyFil * (non-PHPdoc) * @see core_kernel_persistence_ClassInterface::getInstancesPropertyValues() */ - public function getInstancesPropertyValues(core_kernel_classes_Class $resource, core_kernel_classes_Property $property, $propertyFilters = [], $options = []) - { + public function getInstancesPropertyValues( + core_kernel_classes_Class $resource, + core_kernel_classes_Property $property, + $propertyFilters = [], + $options = [] + ) { $returnValue = []; $distinct = isset($options['distinct']) ? $options['distinct'] : false; @@ -413,7 +436,8 @@ public function getInstancesPropertyValues(core_kernel_classes_Class $resource, $query .= ' DISTINCT'; } - $query .= " object FROM (SELECT overq.subject, valuesq.object FROM (${filteredQuery}) as overq JOIN statements AS valuesq ON (overq.subject = valuesq.subject AND valuesq.predicate = ?)) AS overrootq"; + $query .= " object FROM (SELECT overq.subject, valuesq.object FROM (${filteredQuery}) as overq JOIN statements " + . "AS valuesq ON (overq.subject = valuesq.subject AND valuesq.predicate = ?)) AS overrootq"; $sqlResult = $this->getPersistence()->query($query, [$property->getUri()]); while ($row = $sqlResult->fetch()) { @@ -445,11 +469,15 @@ public function createInstanceWithProperties(core_kernel_classes_Class $type, $p $returnValue = null; if (isset($properties[OntologyRdf::RDF_TYPE])) { - throw new core_kernel_persistence_Exception('Additional types in createInstanceWithProperties not permited'); + throw new core_kernel_persistence_Exception( + 'Additional types in createInstanceWithProperties not permited' + ); } $properties[OntologyRdf::RDF_TYPE] = $type; - $returnValue = $this->getModel()->getResource($this->getServiceLocator()->get(UriProvider::SERVICE_ID)->provide()); + $returnValue = $this->getModel()->getResource( + $this->getServiceLocator()->get(UriProvider::SERVICE_ID)->provide() + ); $returnValue->setPropertiesValues($properties); return $returnValue; @@ -486,7 +514,9 @@ public function deleteInstances(core_kernel_classes_Class $resource, $resources, $this->getPersistence()->exec($query); $returnValue = true; } catch (DBALException $e) { - throw new core_kernel_persistence_smoothsql_Exception("An error occured while deleting resources: " . $e->getMessage()); + throw new core_kernel_persistence_smoothsql_Exception( + "An error occured while deleting resources: " . $e->getMessage() + ); } } @@ -524,7 +554,9 @@ public function getFilteredQuery(core_kernel_classes_Class $resource, $propertyF $rdftypes[] = $resource->getUri(); } - $and = (isset($options['chaining']) === false) ? true : ((strtolower($options['chaining']) === 'and') ? true : false); + $and = (isset($options['chaining']) === false) + ? true + : ((strtolower($options['chaining']) === 'and') ? true : false); $like = (isset($options['like']) === false) ? true : $options['like']; $lang = (isset($options['lang']) === false) ? '' : $options['lang']; $offset = (isset($options['offset']) === false) ? 0 : $options['offset']; @@ -534,9 +566,31 @@ public function getFilteredQuery(core_kernel_classes_Class $resource, $propertyF if ($this->getServiceLocator()->has(ComplexSearchService::SERVICE_ID)) { $search = $this->getModel()->getSearchInterface(); - $query = $search->getQuery($this->getModel(), $rdftypes, $propertyFilters, $and, $like, $lang, $offset, $limit, $order, $orderdir); + $query = $search->getQuery( + $this->getModel(), + $rdftypes, + $propertyFilters, + $and, + $like, + $lang, + $offset, + $limit, + $order, + $orderdir + ); } else { - $query = core_kernel_persistence_smoothsql_Utils::buildFilterQuery($this->getModel(), $rdftypes, $propertyFilters, $and, $like, $lang, $offset, $limit, $order, $orderdir); + $query = core_kernel_persistence_smoothsql_Utils::buildFilterQuery( + $this->getModel(), + $rdftypes, + $propertyFilters, + $and, + $like, + $lang, + $offset, + $limit, + $order, + $orderdir + ); } return $query; diff --git a/core/kernel/persistence/smoothsql/class.Property.php b/core/kernel/persistence/smoothsql/class.Property.php index b4fa6d6b1..b34d43a81 100644 --- a/core/kernel/persistence/smoothsql/class.Property.php +++ b/core/kernel/persistence/smoothsql/class.Property.php @@ -37,7 +37,8 @@ * @package generis */ -class core_kernel_persistence_smoothsql_Property extends core_kernel_persistence_smoothsql_Resource implements core_kernel_persistence_PropertyInterface +class core_kernel_persistence_smoothsql_Property extends core_kernel_persistence_smoothsql_Resource implements + core_kernel_persistence_PropertyInterface { // --- ASSOCIATIONS --- @@ -87,7 +88,10 @@ public function isLgDependent(core_kernel_classes_Resource $resource) public function isMultiple(core_kernel_classes_Resource $resource) { $returnValue = (bool) false; - throw new core_kernel_persistence_ProhibitedFunctionException("not implemented => The function (" . __METHOD__ . ") is not available in this persistence implementation (" . __CLASS__ . ")"); + throw new core_kernel_persistence_ProhibitedFunctionException( + "not implemented => The function (" . __METHOD__ + . ") is not available in this persistence implementation (" . __CLASS__ . ")" + ); return (bool) $returnValue; } @@ -102,7 +106,10 @@ public function isMultiple(core_kernel_classes_Resource $resource) public function getRange(core_kernel_classes_Resource $resource) { $returnValue = null; - throw new core_kernel_persistence_ProhibitedFunctionException("not implemented => The function (" . __METHOD__ . ") is not available in this persistence implementation (" . __CLASS__ . ")"); + throw new core_kernel_persistence_ProhibitedFunctionException( + "not implemented => The function (" . __METHOD__ + . ") is not available in this persistence implementation (" . __CLASS__ . ")" + ); return $returnValue; } diff --git a/core/kernel/persistence/smoothsql/class.Resource.php b/core/kernel/persistence/smoothsql/class.Resource.php index 00c209297..533167d16 100644 --- a/core/kernel/persistence/smoothsql/class.Resource.php +++ b/core/kernel/persistence/smoothsql/class.Resource.php @@ -113,8 +113,11 @@ public function getTypes(core_kernel_classes_Resource $resource) * @throws core_kernel_persistence_Exception * @author Joel Bout, */ - public function getPropertyValues(core_kernel_classes_Resource $resource, core_kernel_classes_Property $property, $options = []) - { + public function getPropertyValues( + core_kernel_classes_Resource $resource, + core_kernel_classes_Property $property, + $options = [] + ) { $returnValue = []; $one = isset($options['one']) && $options['one'] == true ? true : false; @@ -159,8 +162,15 @@ public function getPropertyValues(core_kernel_classes_Resource $resource, core_k $returnValue[] = $this->getPersistence()->getPlatForm()->getPhpTextValue($row['object']); } } else { - // Filter result by language and return one set of values (User language in top priority, default language in second and the fallback language (null) in third) - $returnValue = core_kernel_persistence_smoothsql_Utils::filterByLanguage($this->getPersistence(), $result->fetchAll(), 'l_language', $lang, $default); + // Filter result by language and return one set of values (User language in top priority, default + // language in second and the fallback language (null) in third) + $returnValue = core_kernel_persistence_smoothsql_Utils::filterByLanguage( + $this->getPersistence(), + $result->fetchAll(), + 'l_language', + $lang, + $default + ); } } @@ -178,8 +188,11 @@ public function getPropertyValues(core_kernel_classes_Resource $resource, core_k * @throws core_kernel_persistence_Exception * @author Joel Bout, */ - public function getPropertyValuesByLg(core_kernel_classes_Resource $resource, core_kernel_classes_Property $property, $lg) - { + public function getPropertyValuesByLg( + core_kernel_classes_Resource $resource, + core_kernel_classes_Property $property, + $lg + ) { $options = ['lg' => $lg]; $returnValue = new core_kernel_classes_ContainerCollection($resource); @@ -201,8 +214,12 @@ public function getPropertyValuesByLg(core_kernel_classes_Resource $resource, co * @return boolean * @author Joel Bout, */ - public function setPropertyValue(core_kernel_classes_Resource $resource, core_kernel_classes_Property $property, $object, $lg = null) - { + public function setPropertyValue( + core_kernel_classes_Resource $resource, + core_kernel_classes_Property $property, + $object, + $lg = null + ) { $object = $object instanceof core_kernel_classes_Resource ? $object->getUri() : (string) $object; if ($property->isLgDependent()) { $lang = ((null != $lg) @@ -266,8 +283,12 @@ public function setPropertiesValues(core_kernel_classes_Resource $resource, $pro * @return boolean * @author Joel Bout, */ - public function setPropertyValueByLg(core_kernel_classes_Resource $resource, core_kernel_classes_Property $property, $value, $lg) - { + public function setPropertyValueByLg( + core_kernel_classes_Resource $resource, + core_kernel_classes_Property $property, + $value, + $lg + ) { $triple = core_kernel_classes_Triple::createTriple( $this->getNewTripleModelId(), $resource->getUri(), @@ -288,8 +309,11 @@ public function setPropertyValueByLg(core_kernel_classes_Resource $resource, cor * @return boolean * @author Joel Bout, */ - public function removePropertyValues(core_kernel_classes_Resource $resource, core_kernel_classes_Property $property, $options = []) - { + public function removePropertyValues( + core_kernel_classes_Resource $resource, + core_kernel_classes_Property $property, + $options = [] + ) { // Optional params $pattern = isset($options['pattern']) && !is_null($options['pattern']) ? $options['pattern'] : null; $like = isset($options['like']) && $options['like'] == true ? true : false; @@ -301,14 +325,22 @@ public function removePropertyValues(core_kernel_classes_Resource $resource, cor $conditions = []; if (is_string($pattern)) { if (!is_null($pattern)) { - $searchPattern = core_kernel_persistence_smoothsql_Utils::buildSearchPattern($this->getPersistence(), $pattern, $like); + $searchPattern = core_kernel_persistence_smoothsql_Utils::buildSearchPattern( + $this->getPersistence(), + $pattern, + $like + ); $conditions[] = '( ' . $objectType . ' ' . $searchPattern . ' )'; } } elseif (is_array($pattern)) { if (count($pattern) > 0) { $multiCondition = "( "; foreach ($pattern as $i => $patternToken) { - $searchPattern = core_kernel_persistence_smoothsql_Utils::buildSearchPattern($this->getPersistence(), $patternToken, $like); + $searchPattern = core_kernel_persistence_smoothsql_Utils::buildSearchPattern( + $this->getPersistence(), + $patternToken, + $like + ); if ($i > 0) { $multiCondition .= " OR "; } @@ -358,8 +390,12 @@ public function removePropertyValues(core_kernel_classes_Resource $resource, cor * @return boolean * @author Joel Bout, */ - public function removePropertyValueByLg(core_kernel_classes_Resource $resource, core_kernel_classes_Property $property, $lg, $options = []) - { + public function removePropertyValueByLg( + core_kernel_classes_Resource $resource, + core_kernel_classes_Property $property, + $lg, + $options = [] + ) { $sqlQuery = 'DELETE FROM statements WHERE subject = ? and predicate = ? and l_language = ?'; //be sure the property we try to remove is included in an updatable model $sqlQuery .= ' AND ' . $this->getModelWriteSqlCondition(); @@ -388,7 +424,8 @@ public function removePropertyValueByLg(core_kernel_classes_Resource $resource, public function getRdfTriples(core_kernel_classes_Resource $resource) { // TODO: refactor this to use a triple store abstraction - $query = 'SELECT * FROM statements WHERE subject = ? AND ' . $this->getModelReadSqlCondition() . ' ORDER BY predicate'; + $query = 'SELECT * FROM statements WHERE subject = ? AND ' . $this->getModelReadSqlCondition() + . ' ORDER BY predicate'; $result = $this->getPersistence()->query($query, [$resource->getUri()]); $returnValue = new core_kernel_classes_ContainerCollection(new common_Object(__METHOD__)); @@ -499,7 +536,9 @@ public function delete(core_kernel_classes_Resource $resource, $deleteReference if (!$returnValue) { $returnValue = false; } elseif ($deleteReference) { - $sqlQuery = 'DELETE FROM statements WHERE ' . $this->getPersistence()->getPlatForm()->getObjectTypeCondition() . ' = ? AND ' . $this->getModelWriteSqlCondition(); + $sqlQuery = 'DELETE FROM statements WHERE ' + . $this->getPersistence()->getPlatForm()->getObjectTypeCondition() . ' = ? AND ' + . $this->getModelWriteSqlCondition(); $return = $this->getPersistence()->exec($sqlQuery, [$resource->getUri()]); if ($return !== false) { @@ -591,8 +630,8 @@ public function setType(core_kernel_classes_Resource $resource, core_kernel_clas */ public function removeType(core_kernel_classes_Resource $resource, core_kernel_classes_Class $class) { - $query = 'DELETE FROM statements - WHERE subject = ? AND predicate = ? AND ' . $this->getPersistence()->getPlatForm()->getObjectTypeCondition() . ' = ?'; + $query = 'DELETE FROM statements WHERE subject = ? AND predicate = ? AND ' + . $this->getPersistence()->getPlatForm()->getObjectTypeCondition() . ' = ?'; //be sure the property we try to remove is included in an updatable model $query .= ' AND ' . $this->getModelWriteSqlCondition(); diff --git a/core/kernel/persistence/smoothsql/class.SmoothModel.php b/core/kernel/persistence/smoothsql/class.SmoothModel.php index 255b9937e..cef6f2d9c 100755 --- a/core/kernel/persistence/smoothsql/class.SmoothModel.php +++ b/core/kernel/persistence/smoothsql/class.SmoothModel.php @@ -34,7 +34,9 @@ * @author joel bout * @package generis */ -class core_kernel_persistence_smoothsql_SmoothModel extends ConfigurableService implements Ontology, SchemaProviderInterface +class core_kernel_persistence_smoothsql_SmoothModel extends ConfigurableService implements + Ontology, + SchemaProviderInterface { public const OPTION_PERSISTENCE = 'persistence'; public const OPTION_READABLE_MODELS = 'readable'; @@ -186,7 +188,9 @@ public static function getReadableModelIds() { $model = ModelManager::getModel(); if (!$model instanceof self) { - throw new common_exception_Error(__FUNCTION__ . ' called on ' . get_class($model) . ' model implementation'); + throw new common_exception_Error( + __FUNCTION__ . ' called on ' . get_class($model) . ' model implementation' + ); } return $model->getReadableModels(); } @@ -201,7 +205,9 @@ public static function getUpdatableModelIds() { $model = ModelManager::getModel(); if (!$model instanceof self) { - throw new common_exception_Error(__FUNCTION__ . ' called on ' . get_class($model) . ' model implementation'); + throw new common_exception_Error( + __FUNCTION__ . ' called on ' . get_class($model) . ' model implementation' + ); } return $model->getWritableModels(); } diff --git a/core/kernel/persistence/smoothsql/class.SmoothRdf.php b/core/kernel/persistence/smoothsql/class.SmoothRdf.php index c1d6d186c..dda69ced7 100644 --- a/core/kernel/persistence/smoothsql/class.SmoothRdf.php +++ b/core/kernel/persistence/smoothsql/class.SmoothRdf.php @@ -144,7 +144,15 @@ protected function insertValues(array $valuesToInsert) public function remove(core_kernel_classes_Triple $triple) { $query = "DELETE FROM statements WHERE subject = ? AND predicate = ? AND object = ? AND l_language = ?;"; - return $this->getPersistence()->exec($query, [$triple->subject, $triple->predicate, $triple->object, is_null($triple->lg) ? '' : $triple->lg]); + return $this->getPersistence()->exec( + $query, + [ + $triple->subject, + $triple->predicate, + $triple->object, + is_null($triple->lg) ? '' : $triple->lg + ] + ); } /** diff --git a/core/kernel/persistence/smoothsql/class.Utils.php b/core/kernel/persistence/smoothsql/class.Utils.php index a7140f89b..cb3076f13 100644 --- a/core/kernel/persistence/smoothsql/class.Utils.php +++ b/core/kernel/persistence/smoothsql/class.Utils.php @@ -101,12 +101,17 @@ public static function getFirstLanguage($values) /** * Filter a $dataset by language. * - * @param mixed dataset - * @param string langColname + * @param mixed $dataset + * @param string $langColname * @return array */ - public static function filterByLanguage(common_persistence_SqlPersistence $persistence, $dataset, $langColname, $selectedLanguage, $defaultLanguage) - { + public static function filterByLanguage( + common_persistence_SqlPersistence $persistence, + $dataset, + $langColname, + $selectedLanguage, + $defaultLanguage + ) { $returnValue = []; $result = self::sortByLanguage($persistence, $dataset, $langColname, $selectedLanguage, $defaultLanguage); @@ -147,8 +152,9 @@ public static function identifyFirstLanguage($values) /** * Build a SQL search pattern on basis of a pattern and a comparison mode. * - * @param tring pattern A value to compare. - * @param boolean like The manner to compare values. If set to true, the LIKE SQL operator will be used. If set to false, the = (equal) SQL operator will be used. + * @param string $pattern A value to compare. + * @param boolean $like The manner to compare values. If set to true, the LIKE SQL operator will be used. If set + * to false, the = (equal) SQL operator will be used. * @return string */ public static function buildSearchPattern(common_persistence_SqlPersistence $persistence, $pattern, $like = true) @@ -194,8 +200,13 @@ public static function buildSearchPattern(common_persistence_SqlPersistence $per return $returnValue; } - public static function buildPropertyQuery(core_kernel_persistence_smoothsql_SmoothModel $model, $propertyUri, $values, $like, $lang = '') - { + public static function buildPropertyQuery( + core_kernel_persistence_smoothsql_SmoothModel $model, + $propertyUri, + $values, + $like, + $lang = '' + ) { $persistence = $model->getPersistence(); // Deal with predicate... @@ -257,8 +268,18 @@ public static function buildUnionQuery($propertyQueries) } } - public static function buildFilterQuery(core_kernel_persistence_smoothsql_SmoothModel $model, $classUri, array $propertyFilters, $and = true, $like = true, $lang = '', $offset = 0, $limit = 0, $order = '', $orderDir = 'ASC') - { + public static function buildFilterQuery( + core_kernel_persistence_smoothsql_SmoothModel $model, + $classUri, + array $propertyFilters, + $and = true, + $like = true, + $lang = '', + $offset = 0, + $limit = 0, + $order = '', + $orderDir = 'ASC' + ) { $orderDir = self::sanitizeOrderDirection($orderDir); diff --git a/core/kernel/persistence/smoothsql/search/ComplexSearchService.php b/core/kernel/persistence/smoothsql/search/ComplexSearchService.php index c5a15450b..2d4f0e7b5 100755 --- a/core/kernel/persistence/smoothsql/search/ComplexSearchService.php +++ b/core/kernel/persistence/smoothsql/search/ComplexSearchService.php @@ -223,8 +223,18 @@ protected function validValue($value) * @param string $orderDir * @return string */ - public function getQuery(core_kernel_persistence_smoothsql_SmoothModel $model, $classUri, array $propertyFilters, $and = true, $isLikeOperator = true, $lang = '', $offset = 0, $limit = 0, $order = '', $orderDir = 'ASC') - { + public function getQuery( + core_kernel_persistence_smoothsql_SmoothModel $model, + $classUri, + array $propertyFilters, + $and = true, + $isLikeOperator = true, + $lang = '', + $offset = 0, + $limit = 0, + $order = '', + $orderDir = 'ASC' + ) { $query = $this->getGateway()->query()->setLimit($limit)->setOffset($offset); if (!empty($order)) { diff --git a/core/kernel/persistence/smoothsql/search/QueryJoiner.php b/core/kernel/persistence/smoothsql/search/QueryJoiner.php index 68e278105..be88e447a 100644 --- a/core/kernel/persistence/smoothsql/search/QueryJoiner.php +++ b/core/kernel/persistence/smoothsql/search/QueryJoiner.php @@ -41,7 +41,12 @@ * * @author Christophe GARCIA */ -class QueryJoiner implements DriverSensitiveInterface, SortableInterface, LimitableInterface, ParentFluateInterface, OptionsInterface +class QueryJoiner implements + DriverSensitiveInterface, + SortableInterface, + LimitableInterface, + ParentFluateInterface, + OptionsInterface { use SortableTrait; @@ -177,7 +182,8 @@ public function setLanguageCondition($language, $emptyAvailable = false) $sql = ' AND ( '; $sql .= $languageField . ' = ' . $this->getDriverEscaper()->quote($languageValue) . ''; if ($emptyAvailable) { - $sql .= ' ' . $this->getDriverEscaper()->dbCommand('OR') . ' ' . $languageField . ' = ' . $this->getDriverEscaper()->getEmpty(); + $sql .= ' ' . $this->getDriverEscaper()->dbCommand('OR') . ' ' . $languageField . ' = ' + . $this->getDriverEscaper()->getEmpty(); } $sql .= ' ) '; return $sql; @@ -195,10 +201,13 @@ protected function sortedQuery($main, $join) $aggrObject = $this->getDriverEscaper()->reserved('J') . '.' . $this->getDriverEscaper()->reserved('object'); - $query = $this->getDriverEscaper()->dbCommand('SELECT') . ' ' . $this->getDriverEscaper()->reserved('subject') . ' ' . - $this->getDriverEscaper()->dbCommand('FROM') . ' ( ' . - $this->getDriverEscaper()->dbCommand('SELECT') . ' ' . $this->getDriverEscaper()->dbCommand('DISTINCT') . ' ' . - $this->getDriverEscaper()->reserved('T') . '.' . $this->getDriverEscaper()->reserved('subject') . ' , '; + $query = $this->getDriverEscaper()->dbCommand('SELECT') . ' ' + . $this->getDriverEscaper()->reserved('subject') . ' ' + . $this->getDriverEscaper()->dbCommand('FROM') . ' ( ' + . $this->getDriverEscaper()->dbCommand('SELECT') . ' ' + . $this->getDriverEscaper()->dbCommand('DISTINCT') . ' ' + . $this->getDriverEscaper()->reserved('T') . '.' + . $this->getDriverEscaper()->reserved('subject') . ' , '; $sortKeys = []; @@ -216,19 +225,24 @@ protected function sortedQuery($main, $join) $index++; } - $query .= implode(' , ', $sortKeys) . ' ' . $this->getDriverEscaper()->dbCommand('FROM') . ' ( ' . - $main . ' )' . - $this->getDriverEscaper()->dbCommand('AS') . ' ' . $this->getDriverEscaper()->reserved('T') . - $this->getDriverEscaper()->dbCommand('JOIN') . ' ( ' . - $this->getDriverEscaper()->dbCommand('SELECT') . ' ' . $this->getDriverEscaper()->reserved('subject') . ' , ' . - $this->getDriverEscaper()->reserved('object') . ' ' . $this->getDriverEscaper()->dbCommand('FROM') . ' ' . - $this->getDriverEscaper()->reserved('statements') . ' ' . $this->getDriverEscaper()->dbCommand('WHERE') . ' ' . - $this->getDriverEscaper()->reserved('predicate') . ' = ' . - $this->getDriverEscaper()->quote($this->getDriverEscaper()->escape($this->on)) . ' ) ' . - $this->getDriverEscaper()->dbCommand('AS') . ' ' . $this->getDriverEscaper()->reserved('R') . - $this->getDriverEscaper()->dbCommand('ON') . ' ( ' . - $this->getDriverEscaper()->reserved('T') . '.' . $this->getDriverEscaper()->reserved('subject') . ' = ' . - $this->getDriverEscaper()->reserved('R') . '.' . $this->getDriverEscaper()->reserved('subject') . ' ) '; + $query .= implode(' , ', $sortKeys) . ' ' + . $this->getDriverEscaper()->dbCommand('FROM') . ' ( ' . $main . ' )' + . $this->getDriverEscaper()->dbCommand('AS') . ' ' + . $this->getDriverEscaper()->reserved('T') . $this->getDriverEscaper()->dbCommand('JOIN') + . ' ( ' . $this->getDriverEscaper()->dbCommand('SELECT') . ' ' + . $this->getDriverEscaper()->reserved('subject') . ' , ' + . $this->getDriverEscaper()->reserved('object') . ' ' + . $this->getDriverEscaper()->dbCommand('FROM') . ' ' + . $this->getDriverEscaper()->reserved('statements') . ' ' + . $this->getDriverEscaper()->dbCommand('WHERE') . ' ' + . $this->getDriverEscaper()->reserved('predicate') . ' = ' + . $this->getDriverEscaper()->quote($this->getDriverEscaper()->escape($this->on)) . ' ) ' + . $this->getDriverEscaper()->dbCommand('AS') . ' ' + . $this->getDriverEscaper()->reserved('R') . $this->getDriverEscaper()->dbCommand('ON') + . ' ( ' . $this->getDriverEscaper()->reserved('T') . '.' + . $this->getDriverEscaper()->reserved('subject') . ' = ' + . $this->getDriverEscaper()->reserved('R') . '.' + . $this->getDriverEscaper()->reserved('subject') . ' ) '; $index = 1; @@ -238,40 +252,56 @@ protected function sortedQuery($main, $join) $orderSub = 'SUBJ' . $index; $orderAlias = 'ORDERJ' . $index; - $query .= $this->getDriverEscaper()->dbCommand('JOIN') . ' ( ' . - $this->getDriverEscaper()->dbCommand('SELECT') . ' ' . - $this->getDriverEscaper()->reserved($orderAlias) . '.' . $this->getDriverEscaper()->reserved('subject') . ' , ' . - $this->getDriverEscaper()->reserved($orderAlias) . '.' . $this->getDriverEscaper()->reserved('object') . ' ' . - $this->getDriverEscaper()->dbCommand('FROM') . ' ( ' . - $join . ')' . - $this->getDriverEscaper()->dbCommand('AS') . ' ' . $this->getDriverEscaper()->reserved($orderSub) . ' ' . - $this->getDriverEscaper()->dbCommand('JOIN') . ' ( ' . - $this->getDriverEscaper()->dbCommand('SELECT') . ' ' . $this->getDriverEscaper()->reserved('subject') . ' , ' . - $this->getDriverEscaper()->reserved('object') . ' ' . $this->getDriverEscaper()->dbCommand('FROM') . ' ' . - $this->getDriverEscaper()->reserved('statements') . ' ' . $this->getDriverEscaper()->dbCommand('WHERE') . ' ' . - $this->getDriverEscaper()->reserved('predicate') . ' = ' . - $this->getDriverEscaper()->quote($this->getDriverEscaper()->escape($predicate)) . ' ' . - $this->getLanguage() . ' ' . $this->getDriverEscaper()->dbCommand('GROUP') . ' ' . $this->getDriverEscaper()->dbCommand('BY') . ' ' . - $this->getDriverEscaper()->reserved('subject') . ' , ' . - $this->getDriverEscaper()->reserved('object') . ' ) ' . - $this->getDriverEscaper()->dbCommand('AS') . ' ' . $this->getDriverEscaper()->reserved($orderAlias) . ' ' . - $this->getDriverEscaper()->dbCommand('ON') . ' ( ' . - $this->getDriverEscaper()->reserved($orderSub) . '.' . $this->getDriverEscaper()->reserved('subject') . ' = ' . - $this->getDriverEscaper()->reserved($orderAlias) . '.' . $this->getDriverEscaper()->reserved('subject') . ' ) ) ' . - $this->getDriverEscaper()->dbCommand('AS') . ' ' . $this->getDriverEscaper()->reserved($alias) . ' ' . - $this->getDriverEscaper()->dbCommand('ON') . ' ( ' . - $this->getDriverEscaper()->reserved($alias) . '.' . $this->getDriverEscaper()->reserved('subject') . ' = ' . - $this->getDriverEscaper()->reserved('R') . '.' . $this->getDriverEscaper()->reserved('object') . ' ) '; - - $sortBy[] = $this->getDriverEscaper()->reserved('sorter' . $index) . ' ' . $this->getDriverEscaper()->dbCommand($sortOrder); + $query .= $this->getDriverEscaper()->dbCommand('JOIN') . ' ( ' + . $this->getDriverEscaper()->dbCommand('SELECT') . ' ' + . $this->getDriverEscaper()->reserved($orderAlias) . '.' + . $this->getDriverEscaper()->reserved('subject') . ' , ' + . $this->getDriverEscaper()->reserved($orderAlias) . '.' + . $this->getDriverEscaper()->reserved('object') . ' ' + . $this->getDriverEscaper()->dbCommand('FROM') . ' ( ' . $join . ')' + . $this->getDriverEscaper()->dbCommand('AS') . ' ' + . $this->getDriverEscaper()->reserved($orderSub) . ' ' + . $this->getDriverEscaper()->dbCommand('JOIN') . ' ( ' + . $this->getDriverEscaper()->dbCommand('SELECT') . ' ' + . $this->getDriverEscaper()->reserved('subject') . ' , ' + . $this->getDriverEscaper()->reserved('object') . ' ' + . $this->getDriverEscaper()->dbCommand('FROM') . ' ' + . $this->getDriverEscaper()->reserved('statements') . ' ' + . $this->getDriverEscaper()->dbCommand('WHERE') . ' ' + . $this->getDriverEscaper()->reserved('predicate') . ' = ' + . $this->getDriverEscaper()->quote($this->getDriverEscaper()->escape($predicate)) . ' ' + . $this->getLanguage() . ' ' . $this->getDriverEscaper()->dbCommand('GROUP') . ' ' + . $this->getDriverEscaper()->dbCommand('BY') . ' ' + . $this->getDriverEscaper()->reserved('subject') . ' , ' + . $this->getDriverEscaper()->reserved('object') . ' ) ' + . $this->getDriverEscaper()->dbCommand('AS') . ' ' + . $this->getDriverEscaper()->reserved($orderAlias) . ' ' + . $this->getDriverEscaper()->dbCommand('ON') . ' ( ' + . $this->getDriverEscaper()->reserved($orderSub) . '.' + . $this->getDriverEscaper()->reserved('subject') . ' = ' + . $this->getDriverEscaper()->reserved($orderAlias) . '.' + . $this->getDriverEscaper()->reserved('subject') . ' ) ) ' + . $this->getDriverEscaper()->dbCommand('AS') . ' ' + . $this->getDriverEscaper()->reserved($alias) . ' ' + . $this->getDriverEscaper()->dbCommand('ON') . ' ( ' + . $this->getDriverEscaper()->reserved($alias) . '.' + . $this->getDriverEscaper()->reserved('subject') . ' = ' + . $this->getDriverEscaper()->reserved('R') . '.' + . $this->getDriverEscaper()->reserved('object') . ' ) '; + + $sortBy[] = $this->getDriverEscaper()->reserved('sorter' . $index) . ' ' + . $this->getDriverEscaper()->dbCommand($sortOrder); $index++; } - $query .= $this->getDriverEscaper()->dbCommand('GROUP') . ' ' . $this->getDriverEscaper()->dbCommand('BY') . ' ' . - $this->getDriverEscaper()->reserved('T') . '.' . $this->getDriverEscaper()->reserved('subject') . ' ' . - $this->getDriverEscaper()->dbCommand('ORDER') . ' ' . $this->getDriverEscaper()->dbCommand('BY') . ' ' . - implode(' , ', $sortBy) . ' ) ' . - $this->getDriverEscaper()->dbCommand('AS') . ' ' . $this->getDriverEscaper()->reserved('rootq'); + $query .= $this->getDriverEscaper()->dbCommand('GROUP') . ' ' + . $this->getDriverEscaper()->dbCommand('BY') . ' ' + . $this->getDriverEscaper()->reserved('T') . '.' + . $this->getDriverEscaper()->reserved('subject') . ' ' + . $this->getDriverEscaper()->dbCommand('ORDER') . ' ' + . $this->getDriverEscaper()->dbCommand('BY') . ' ' . implode(' , ', $sortBy) . ' ) ' + . $this->getDriverEscaper()->dbCommand('AS') . ' ' + . $this->getDriverEscaper()->reserved('rootq'); return ($query); } @@ -284,38 +314,42 @@ protected function sortedQuery($main, $join) */ protected function unSortedQuery($main, $join) { - - $query = $this->getDriverEscaper()->dbCommand('SELECT') . ' ' . - $this->getDriverEscaper()->dbCommand('DISTINCT') . ' ' . - $this->getDriverEscaper()->reserved('A') . '.' . - $this->getDriverEscaper()->reserved('subject') . ' ' . - $this->getDriverEscaper()->dbCommand('FROM') . ' ' . - '(' . $main . ')' . $this->getDriverEscaper()->dbCommand('AS') . ' ' . - $this->getDriverEscaper()->reserved('A') . ' ' . - $this->getDriverEscaper()->dbCommand('JOIN') . ' ' . - '(' . $this->getDriverEscaper()->dbCommand('SELECT') . ' ' . - $this->getDriverEscaper()->reserved('subject') . ' , ' . $this->getDriverEscaper()->reserved('object') . ' ' . - $this->getDriverEscaper()->dbCommand('FROM') . ' ' . $this->getDriverEscaper()->reserved('statements') . ' ' . - $this->getDriverEscaper()->dbCommand('WHERE') . ' ' . - $this->getDriverEscaper()->reserved('predicate') . ' = ' . - $this->getDriverEscaper()->quote($this->getDriverEscaper()->escape($this->on)) . ') ' . - $this->getDriverEscaper()->dbCommand('AS') . ' ' . $this->getDriverEscaper()->reserved('R') . ' ' . - $this->getDriverEscaper()->dbCommand('ON') . - ' (' . $this->getDriverEscaper()->reserved('A') . '.' . - $this->getDriverEscaper()->reserved('subject') . ' = ' . - $this->getDriverEscaper()->reserved('R') . '.' . - $this->getDriverEscaper()->reserved('subject') . ') ' . - $this->getDriverEscaper()->dbCommand('JOIN') . ' (' . - $this->getDriverEscaper()->dbCommand('SELECT') . ' ' . - $this->getDriverEscaper()->reserved('subject') . ' ' . - $this->getDriverEscaper()->dbCommand('FROM') . ' ' . - '(' . $join . ')' . $this->getDriverEscaper()->dbCommand('AS') . ' ' . - $this->getDriverEscaper()->reserved('sd') . ' ) ' . - $this->getDriverEscaper()->dbCommand('AS') . ' ' . - $this->getDriverEscaper()->reserved('D') . ' ' . - $this->getDriverEscaper()->dbCommand('ON') . - '(' . $this->getDriverEscaper()->reserved('D') . '.' . $this->getDriverEscaper()->reserved('subject') . - ' = ' . $this->getDriverEscaper()->reserved('R') . '.' . $this->getDriverEscaper()->reserved('object') . ')'; + $query = $this->getDriverEscaper()->dbCommand('SELECT') . ' ' + . $this->getDriverEscaper()->dbCommand('DISTINCT') . ' ' + . $this->getDriverEscaper()->reserved('A') . '.' + . $this->getDriverEscaper()->reserved('subject') . ' ' + . $this->getDriverEscaper()->dbCommand('FROM') . ' (' . $main . ')' + . $this->getDriverEscaper()->dbCommand('AS') . ' ' + . $this->getDriverEscaper()->reserved('A') . ' ' + . $this->getDriverEscaper()->dbCommand('JOIN') . ' (' + . $this->getDriverEscaper()->dbCommand('SELECT') . ' ' + . $this->getDriverEscaper()->reserved('subject') . ' , ' + . $this->getDriverEscaper()->reserved('object') . ' ' + . $this->getDriverEscaper()->dbCommand('FROM') . ' ' + . $this->getDriverEscaper()->reserved('statements') . ' ' + . $this->getDriverEscaper()->dbCommand('WHERE') . ' ' + . $this->getDriverEscaper()->reserved('predicate') . ' = ' + . $this->getDriverEscaper()->quote($this->getDriverEscaper()->escape($this->on)) . ') ' + . $this->getDriverEscaper()->dbCommand('AS') . ' ' + . $this->getDriverEscaper()->reserved('R') . ' ' + . $this->getDriverEscaper()->dbCommand('ON') . ' (' + . $this->getDriverEscaper()->reserved('A') . '.' + . $this->getDriverEscaper()->reserved('subject') . ' = ' + . $this->getDriverEscaper()->reserved('R') . '.' + . $this->getDriverEscaper()->reserved('subject') . ') ' + . $this->getDriverEscaper()->dbCommand('JOIN') . ' (' + . $this->getDriverEscaper()->dbCommand('SELECT') . ' ' + . $this->getDriverEscaper()->reserved('subject') . ' ' + . $this->getDriverEscaper()->dbCommand('FROM') . ' ' . '(' . $join . ')' + . $this->getDriverEscaper()->dbCommand('AS') . ' ' + . $this->getDriverEscaper()->reserved('sd') . ' ) ' + . $this->getDriverEscaper()->dbCommand('AS') . ' ' + . $this->getDriverEscaper()->reserved('D') . ' ' + . $this->getDriverEscaper()->dbCommand('ON') . '(' + . $this->getDriverEscaper()->reserved('D') . '.' + . $this->getDriverEscaper()->reserved('subject') . ' = ' + . $this->getDriverEscaper()->reserved('R') . '.' + . $this->getDriverEscaper()->reserved('object') . ')'; if ($this->getRandom()) { $query = $this->getDriverEscaper()->dbCommand('SELECT') . ' ' . @@ -345,11 +379,12 @@ protected function createMetaQuery($main, $join, $count) $query = $this->sortedQuery($main, $join); } if ($count) { - $query = $this->getDriverEscaper()->dbCommand('SELECT') . ' ' . - $this->getDriverEscaper()->dbCommand('COUNT') . - '( ' . $this->getDriverEscaper()->reserved('subject') . ' ) ' . - $this->getDriverEscaper()->dbCommand('AS') . ' ' . $this->getDriverEscaper()->reserved('cpt') . ' ' . - $this->getDriverEscaper()->dbCommand('FROM') . ' ( ' . $query . ' ) as cptQ'; + $query = $this->getDriverEscaper()->dbCommand('SELECT') . ' ' + . $this->getDriverEscaper()->dbCommand('COUNT') . '( ' + . $this->getDriverEscaper()->reserved('subject') . ' ) ' + . $this->getDriverEscaper()->dbCommand('AS') . ' ' + . $this->getDriverEscaper()->reserved('cpt') . ' ' + . $this->getDriverEscaper()->dbCommand('FROM') . ' ( ' . $query . ' ) as cptQ'; return $query; } return $this->addLimit($query); diff --git a/core/kernel/persistence/wrapper/RdfWrapper.php b/core/kernel/persistence/wrapper/RdfWrapper.php index c6e2a04dd..77ab39ca0 100644 --- a/core/kernel/persistence/wrapper/RdfWrapper.php +++ b/core/kernel/persistence/wrapper/RdfWrapper.php @@ -88,9 +88,18 @@ public function add(\core_kernel_classes_Triple $triple) $resource = new \core_kernel_classes_Resource($triple->subject); $property = new \core_kernel_classes_Property($triple->predicate); if (empty($triple->lg)) { - return $this->rdfsInterface->getResourceImplementation()->setPropertyValue($resource, $property, $triple->object); + return $this->rdfsInterface->getResourceImplementation()->setPropertyValue( + $resource, + $property, + $triple->object + ); } else { - return $this->rdfsInterface->getResourceImplementation()->setPropertyValueByLg($resource, $property, $triple->object, $triple->lg); + return $this->rdfsInterface->getResourceImplementation()->setPropertyValueByLg( + $resource, + $property, + $triple->object, + $triple->lg + ); } } } diff --git a/core/kernel/rules/class.Expression.php b/core/kernel/rules/class.Expression.php index 94fe3d064..c20060b70 100644 --- a/core/kernel/rules/class.Expression.php +++ b/core/kernel/rules/class.Expression.php @@ -15,7 +15,8 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2007-2010 (original work) Public Research Centre Henri Tudor & University of Luxembourg) (under the project TAO-QUAL); + * Copyright (c) 2007-2010 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO-QUAL); * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung * (under the project TAO-TRANSFER); * 2017 (update and modification) Open Assessment Technologies SA (under the project TAO-PRODUCT); @@ -155,7 +156,9 @@ public function getFirstExpression() $returnValue = null; if (empty($this->firstExpression)) { $property = new core_kernel_classes_Property(RulesRdf::PROPERTY_FIRST_EXPRESSION); - $this->firstExpression = new core_kernel_rules_Expression($this->getUniquePropertyValue($property)->getUri()); + $this->firstExpression = new core_kernel_rules_Expression( + $this->getUniquePropertyValue($property)->getUri() + ); } $returnValue = $this->firstExpression; return $returnValue; @@ -173,7 +176,9 @@ public function getSecondExpression() $returnValue = null; if (empty($this->secondExpression)) { $property = new core_kernel_classes_Property(RulesRdf::PROPERTY_SECOND_EXPRESSION); - $this->secondExpression = new core_kernel_rules_Expression($this->getUniquePropertyValue($property)->getUri()); + $this->secondExpression = new core_kernel_rules_Expression( + $this->getUniquePropertyValue($property)->getUri() + ); } $returnValue = $this->secondExpression; return $returnValue; @@ -246,7 +251,10 @@ public function expEval($variable = []) ) { $tempResult = false; foreach ($firstPart->getIterator() as $container) { - common_Logger::d('FirstPart Part is ContainerCollection Second is Container', ['Generis Expression']); + common_Logger::d( + 'FirstPart Part is ContainerCollection Second is Container', + ['Generis Expression'] + ); //TODO For now consider that if only one value of the table return true, //TODO exist unique need to be added @@ -269,7 +277,10 @@ public function expEval($variable = []) && $secondPart instanceof core_kernel_classes_ContainerCollection ) { foreach ($secondPart->getIterator() as $container) { - common_Logger::d('FirstPart Part Container is Second is ContainerCollection', ['Generis Expression']); + common_Logger::d( + 'FirstPart Part Container is Second is ContainerCollection', + ['Generis Expression'] + ); //TODO For now consider that all value of the table need to be equal to return true, , //TODO exist unique need to be added diff --git a/core/kernel/rules/class.ExpressionFactory.php b/core/kernel/rules/class.ExpressionFactory.php index 49880077d..04b84747a 100644 --- a/core/kernel/rules/class.ExpressionFactory.php +++ b/core/kernel/rules/class.ExpressionFactory.php @@ -15,7 +15,8 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2007-2010 (original work) Public Research Centre Henri Tudor & University of Luxembourg) (under the project TAO-QUAL); + * Copyright (c) 2007-2010 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO-QUAL); * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung * (under the project TAO-TRANSFER); * 2017 (update and modification) Open Assessment Technologies SA (under the project TAO-PRODUCT); @@ -60,7 +61,10 @@ public static function createTerminalExpression(core_kernel_rules_Term $term) $label = 'Terminal Expression : ' . $term->getLabel(); $comment = 'Terminal Expression : ' . $term->getUri(); $expressionInst = core_kernel_classes_ResourceFactory::create($expressionClass, $label, $comment); - $terminalExpressionProperty = new core_kernel_classes_Property(RulesRdf::PROPERTY_TERMINAL_EXPRESSION, __METHOD__); + $terminalExpressionProperty = new core_kernel_classes_Property( + RulesRdf::PROPERTY_TERMINAL_EXPRESSION, + __METHOD__ + ); $returnValue = new core_kernel_rules_Expression($expressionInst->getUri()); $returnValue->setPropertyValue($terminalExpressionProperty, $term->getUri()); $returnValue->debug = __METHOD__; @@ -77,8 +81,11 @@ public static function createTerminalExpression(core_kernel_rules_Term $term) * @param Resource operator * @return core_kernel_rules_Expression */ - public static function createRecursiveExpression(core_kernel_rules_Expression $exp1, core_kernel_rules_Expression $exp2, core_kernel_classes_Resource $operator) - { + public static function createRecursiveExpression( + core_kernel_rules_Expression $exp1, + core_kernel_rules_Expression $exp2, + core_kernel_classes_Resource $operator + ) { $returnValue = null; if ($exp1 == null || $exp2 == null || $operator == null) { var_dump($exp1, $exp2, $operator); @@ -89,7 +96,10 @@ public static function createRecursiveExpression(core_kernel_rules_Expression $e $label = 'Expression : ' . $exp1->getLabel() . ' ' . $operator->getLabel() . ' ' . $exp2->getLabel(); $comment = 'Expression : ' . $exp1->getUri() . ' ' . $operator->getUri() . ' ' . $exp2->getUri(); $expressionInst = core_kernel_classes_ResourceFactory::create($expressionClass, $label, $comment); - $terminalExpressionProperty = new core_kernel_classes_Property(RulesRdf::PROPERTY_TERMINAL_EXPRESSION, __METHOD__); + $terminalExpressionProperty = new core_kernel_classes_Property( + RulesRdf::PROPERTY_TERMINAL_EXPRESSION, + __METHOD__ + ); $logicalOperatorProperty = new core_kernel_classes_Property(RulesRdf::PROPERTY_HASLOGICALOPERATOR, __METHOD__); $firstExpressionProperty = new core_kernel_classes_Property(RulesRdf::PROPERTY_FIRST_EXPRESSION, __METHOD__); $secondExpressionProperty = new core_kernel_classes_Property(RulesRdf::PROPERTY_SECOND_EXPRESSION, __METHOD__); diff --git a/core/kernel/rules/class.Operation.php b/core/kernel/rules/class.Operation.php index 31a504df5..074e5372f 100644 --- a/core/kernel/rules/class.Operation.php +++ b/core/kernel/rules/class.Operation.php @@ -15,7 +15,8 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2007-2010 (original work) Public Research Centre Henri Tudor & University of Luxembourg) (under the project TAO-QUAL); + * Copyright (c) 2007-2010 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO-QUAL); * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung * (under the project TAO-TRANSFER); * 2017 (update and modification) Open Assessment Technologies SA (under the project TAO-PRODUCT) @@ -188,8 +189,11 @@ public function evaluate($variable = []) * @param Resource operator * @return mixed */ - public function evaluateRecursiveOperation(core_kernel_classes_Literal $first, core_kernel_classes_Literal $second, core_kernel_classes_Resource $operator) - { + public function evaluateRecursiveOperation( + core_kernel_classes_Literal $first, + core_kernel_classes_Literal $second, + core_kernel_classes_Resource $operator + ) { switch ($operator->getUri()) { diff --git a/core/kernel/rules/class.OperationFactory.php b/core/kernel/rules/class.OperationFactory.php index 69f4a8c95..54d666fc2 100644 --- a/core/kernel/rules/class.OperationFactory.php +++ b/core/kernel/rules/class.OperationFactory.php @@ -15,7 +15,8 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2007-2010 (original work) Public Research Centre Henri Tudor & University of Luxembourg) (under the project TAO-QUAL); + * Copyright (c) 2007-2010 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO-QUAL); * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung * (under the project TAO-TRANSFER); * 2017 (update and modification) Open Assessment Technologies SA (under the project TAO-PRODUCT); @@ -52,8 +53,11 @@ class core_kernel_rules_OperationFactory * @param Resource operator * @return core_kernel_rules_Operation */ - public static function createOperation(core_kernel_rules_Term $term1, core_kernel_rules_Term $term2, core_kernel_classes_Resource $operator) - { + public static function createOperation( + core_kernel_rules_Term $term1, + core_kernel_rules_Term $term2, + core_kernel_classes_Resource $operator + ) { $returnValue = null; $operationClass = new core_kernel_classes_Class(RulesRdf::CLASS_OPERATION, __METHOD__); $label = 'Def Operation Label ' . $term1->getLabel() . ' ' . $operator->getLabel() . ' ' . $term2->getLabel(); diff --git a/core/kernel/rules/class.Rule.php b/core/kernel/rules/class.Rule.php index 34285aeb3..131b90366 100644 --- a/core/kernel/rules/class.Rule.php +++ b/core/kernel/rules/class.Rule.php @@ -15,7 +15,8 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2007-2010 (original work) Public Research Centre Henri Tudor & University of Luxembourg) (under the project TAO-QUAL); + * Copyright (c) 2007-2010 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO-QUAL); * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung * (under the project TAO-TRANSFER); * 2017 (update and modification) Open Assessment Technologies SA (under the project TAO-PRODUCT); @@ -60,7 +61,10 @@ public function getExpression() common_Logger::i('Evaluating rule ' . $this->getLabel() . '(' . $this->getUri() . ')', ['Generis Rule']); if (empty($this->expression)) { $property = new core_kernel_classes_Property(RulesRdf::PROPERTY_RULE_IF); - $this->expression = new core_kernel_rules_Expression($this->getUniquePropertyValue($property)->getUri(), __METHOD__); + $this->expression = new core_kernel_rules_Expression( + $this->getUniquePropertyValue($property)->getUri(), + __METHOD__ + ); } $returnValue = $this->expression; return $returnValue; diff --git a/core/kernel/rules/class.Term.php b/core/kernel/rules/class.Term.php index 772a41cb7..3837ca938 100644 --- a/core/kernel/rules/class.Term.php +++ b/core/kernel/rules/class.Term.php @@ -15,7 +15,8 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2007-2010 (original work) Public Research Centre Henri Tudor & University of Luxembourg) (under the project TAO-QUAL); + * Copyright (c) 2007-2010 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO-QUAL); * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung * (under the project TAO-TRANSFER); * 2017 (update and modification) Open Assessment Technologies SA (under the project TAO-PRODUCT); @@ -106,8 +107,11 @@ public function evaluate($variable = []) * @param ContainerCollection $newSet * @return core_kernel_classes_ContainerCollection */ - public function evalutateSetOperation(core_kernel_classes_Resource $setOperator, common_Collection $actualSet, core_kernel_classes_ContainerCollection $newSet) - { + public function evalutateSetOperation( + core_kernel_classes_Resource $setOperator, + common_Collection $actualSet, + core_kernel_classes_ContainerCollection $newSet + ) { $returnValue = null; if ($setOperator->getUri() == RulesRdf::INSTANCE_OPERATOR_UNION) { $returnValue = $actualSet->union($newSet); @@ -144,19 +148,15 @@ protected function evaluateSPX($variable = []) } try { - $propertyInstance = $this->getUniquePropertyValue(new core_kernel_classes_Property(RulesRdf::PROPERTY_TERM_SPX_PREDICATE)); + $propertyInstance = $this->getUniquePropertyValue( + new core_kernel_classes_Property(RulesRdf::PROPERTY_TERM_SPX_PREDICATE) + ); } catch (common_Exception $e) { echo $e; var_dump($this); die('unable to get property value in Term'); } - // if(array_key_exists($propertyInstance->getUri(),$variable)) { - // $logger->debug('Variable uri : ' . $propertyInstance->getUri() . ' found' , __FILE__, __LINE__); - // $logger->debug('Variable name : ' . $propertyInstance->getLabel() . ' found' , __FILE__, __LINE__); - // $propertyInstance = new core_kernel_classes_Resource($variable[$resource->getUri()]); - // $logger->debug('Variable repaced uri : ' . $propertyInstance->getUri() , __FILE__, __LINE__); - // $logger->debug('Variable repaced name : ' . $propertyInstance->getLabel() , __FILE__, __LINE__); - // } + $property = new core_kernel_classes_Property($propertyInstance->getUri()); common_Logger::d('Property uri ' . $property->getUri(), ['Generis Term evaluateSPX']); common_Logger::d('Property name ' . $property->getLabel(), ['Generis Term evaluateSPX']); diff --git a/core/kernel/rules/class.TermFactory.php b/core/kernel/rules/class.TermFactory.php index 4a3602889..582c4d4e0 100644 --- a/core/kernel/rules/class.TermFactory.php +++ b/core/kernel/rules/class.TermFactory.php @@ -15,7 +15,8 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2007-2010 (original work) Public Research Centre Henri Tudor & University of Luxembourg) (under the project TAO-QUAL); + * Copyright (c) 2007-2010 (original work) Public Research Centre Henri Tudor & University of Luxembourg + * (under the project TAO-QUAL); * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung * (under the project TAO-TRANSFER); * 2017 (update and modification) Open Assessment Technologies SA (under the project TAO-PRODUCT); @@ -54,7 +55,10 @@ public static function createConst($constant) $termConstClass = new core_kernel_classes_Class(RulesRdf::CLASS_TERM_CONST, __METHOD__); $termValueProperty = new core_kernel_classes_Property(RulesRdf::PROPERTY_TERM_VALUE, __METHOD__); $logicalOperatorProperty = new core_kernel_classes_Property(RulesRdf::PROPERTY_HASLOGICALOPERATOR, __METHOD__); - $terminalExpressionProperty = new core_kernel_classes_Property(RulesRdf::PROPERTY_TERMINAL_EXPRESSION, __METHOD__); + $terminalExpressionProperty = new core_kernel_classes_Property( + RulesRdf::PROPERTY_TERMINAL_EXPRESSION, + __METHOD__ + ); $label = 'Def Term Constant Label : ' . $constant; $comment = 'Def Term Constant Comment : ' . $constant; $constantResource = core_kernel_classes_ResourceFactory::create($termConstClass, $label, $comment); diff --git a/core/kernel/uri/Bin2HexUriProvider.php b/core/kernel/uri/Bin2HexUriProvider.php index ce8300ec4..c41bf13ef 100644 --- a/core/kernel/uri/Bin2HexUriProvider.php +++ b/core/kernel/uri/Bin2HexUriProvider.php @@ -49,6 +49,7 @@ class Bin2HexUriProvider extends ConfigurableService implements UriProvider */ public function provide() { - return $this->getOption(self::OPTION_NAMESPACE) . uniqid('i') . getmypid() . bin2hex(openssl_random_pseudo_bytes(8)); + return $this->getOption(self::OPTION_NAMESPACE) . uniqid('i') . getmypid() + . bin2hex(openssl_random_pseudo_bytes(8)); } } diff --git a/core/kernel/uri/MicrotimeRandUriProvider.php b/core/kernel/uri/MicrotimeRandUriProvider.php index 60fb94b19..597875407 100644 --- a/core/kernel/uri/MicrotimeRandUriProvider.php +++ b/core/kernel/uri/MicrotimeRandUriProvider.php @@ -54,7 +54,10 @@ class MicrotimeRandUriProvider extends ConfigurableService implements UriProvide */ public function getPersistence() { - return $this->getServiceLocator()->get(PersistenceManager::SERVICE_ID)->getPersistenceById($this->getOption(self::OPTION_PERSISTENCE)); + return $this + ->getServiceLocator() + ->get(PersistenceManager::SERVICE_ID) + ->getPersistenceById($this->getOption(self::OPTION_PERSISTENCE)); } /** @@ -70,8 +73,11 @@ public function provide() $uriExist = false; do { list($usec, $sec) = explode(" ", microtime()); - $uri = $this->getOption(self::OPTION_NAMESPACE) . 'i' . (str_replace(".", "", $sec . "" . $usec)) . rand(0, 1000); - $sqlResult = $this->getPersistence()->query("SELECT COUNT(subject) AS num FROM statements WHERE subject = '" . $uri . "'"); + $uri = $this->getOption(self::OPTION_NAMESPACE) . 'i' . (str_replace(".", "", $sec + . "" . $usec)) . rand(0, 1000); + $sqlResult = $this->getPersistence()->query( + "SELECT COUNT(subject) AS num FROM statements WHERE subject = '" . $uri . "'" + ); if ($row = $sqlResult->fetch()) { $uriExist = $row['num'] > 0; $sqlResult->closeCursor(); diff --git a/core/kernel/uri/class.DatabaseSerialUriProvider.php b/core/kernel/uri/class.DatabaseSerialUriProvider.php index cd2d25c3f..6d0336052 100644 --- a/core/kernel/uri/class.DatabaseSerialUriProvider.php +++ b/core/kernel/uri/class.DatabaseSerialUriProvider.php @@ -66,9 +66,10 @@ public function provide() { $returnValue = (string) ''; try { - $sth = $this->getPersistence()->query($this->getPersistence()->getPlatForm()->getSqlFunction("generis_sequence_uri_provider"), [ - $this->getOption(self::OPTION_NAMESPACE) - ]); + $sth = $this->getPersistence()->query( + $this->getPersistence()->getPlatForm()->getSqlFunction("generis_sequence_uri_provider"), + [$this->getOption(self::OPTION_NAMESPACE)] + ); if ($sth !== false) { $row = $sth->fetch(); @@ -76,7 +77,10 @@ public function provide() $returnValue = current($row); $sth->closeCursor(); } else { - throw new UriProviderException("An error occured while calling the stored procedure for persistence " . $this->getOption(self::OPTION_PERSISTENCE) . "."); + throw new UriProviderException( + "An error occured while calling the stored procedure for persistence " + . $this->getOption(self::OPTION_PERSISTENCE) . "." + ); } } catch (Exception $e) { throw new UriProviderException("An error occured while calling the stored ': " . $e->getMessage() . "."); diff --git a/core/kernel/users/class.AuthAdapter.php b/core/kernel/users/class.AuthAdapter.php index 74cc71075..23f5e693f 100755 --- a/core/kernel/users/class.AuthAdapter.php +++ b/core/kernel/users/class.AuthAdapter.php @@ -84,7 +84,9 @@ public function authenticate() if (count($users) > 1) { // Multiple users matching - throw new common_exception_InconsistentData("Multiple Users found with the same login '" . $this->username . "'."); + throw new common_exception_InconsistentData( + "Multiple Users found with the same login '" . $this->username . "'." + ); } if (empty($users)) { // fake code execution to prevent timing attacks @@ -98,7 +100,9 @@ public function authenticate() } $userResource = current($users); - $hash = $userResource->getUniquePropertyValue(new core_kernel_classes_Property(GenerisRdf::PROPERTY_USER_PASSWORD)); + $hash = $userResource->getUniquePropertyValue( + new core_kernel_classes_Property(GenerisRdf::PROPERTY_USER_PASSWORD) + ); if (!core_kernel_users_Service::getPasswordHash()->verify($this->password, $hash)) { throw new core_kernel_users_InvalidLoginException(); } diff --git a/core/kernel/users/class.Cache.php b/core/kernel/users/class.Cache.php index 9b9470f7d..837416422 100644 --- a/core/kernel/users/class.Cache.php +++ b/core/kernel/users/class.Cache.php @@ -148,7 +148,8 @@ public static function removeIncludedRoles(core_kernel_classes_Resource $role) * * @access public * @author Jerome Bogaerts, - * @param core_kernel_classes_Resource $role The Generis Role you want to check if its included roles are in the cache memory. + * @param core_kernel_classes_Resource $role The Generis Role you want to check if its included roles are in the + * cache memory. * @return boolean */ public static function areIncludedRolesInCache(core_kernel_classes_Resource $role) diff --git a/core/kernel/users/class.Service.php b/core/kernel/users/class.Service.php index cf6bff0b2..ae4fc4f9a 100644 --- a/core/kernel/users/class.Service.php +++ b/core/kernel/users/class.Service.php @@ -104,12 +104,19 @@ public function loginExists($login, core_kernel_classes_Class $class = null) * @param Resource role A Role to grant to the new User. * @return core_kernel_classes_Resource */ - public function addUser($login, $password, core_kernel_classes_Resource $role = null, core_kernel_classes_Class $class = null) - { + public function addUser( + $login, + $password, + core_kernel_classes_Resource $role = null, + core_kernel_classes_Class $class = null + ) { $returnValue = null; if ($this->loginExists($login)) { - throw new core_kernel_users_Exception("Login '${login}' already in use.", core_kernel_users_Exception::LOGIN_EXITS); + throw new core_kernel_users_Exception( + "Login '${login}' already in use.", + core_kernel_users_Exception::LOGIN_EXITS + ); } else { $role = (empty($role)) ? new core_kernel_classes_Resource(GenerisRdf::INSTANCE_ROLE_GENERIS) : $role; @@ -227,10 +234,15 @@ public function isPasswordValid($password, core_kernel_classes_Resource $user) public function setPassword(core_kernel_classes_Resource $user, $password) { if (!is_string($password)) { - throw new core_kernel_users_Exception('The password must be of "string" type, got ' . gettype($password)); + throw new core_kernel_users_Exception( + 'The password must be of "string" type, got ' . gettype($password) + ); } - $user->editPropertyValues(new core_kernel_classes_Property(GenerisRdf::PROPERTY_USER_PASSWORD), core_kernel_users_Service::getPasswordHash()->encrypt($password)); + $user->editPropertyValues( + new core_kernel_classes_Property(GenerisRdf::PROPERTY_USER_PASSWORD), + core_kernel_users_Service::getPasswordHash()->encrypt($password) + ); } /** @@ -291,7 +303,9 @@ public function userHasRoles(core_kernel_classes_Resource $user, $roles) } } else { // After introducing remote users, we can no longer guarantee that any user and his roles are available - common_Logger::w('Roles of non current user (' . $user->getUri() . ') checked, trying fallback to local ontology'); + common_Logger::w( + 'Roles of non current user (' . $user->getUri() . ') checked, trying fallback to local ontology' + ); $userRoles = array_keys($this->getUserRoles($user)); $identicalRoles = array_intersect($searchRoles, $userRoles); @@ -354,8 +368,9 @@ public function unnatachRole(core_kernel_classes_Resource $user, core_kernel_cla * * @access public * @author Jerome Bogaerts, - * @param string label The label to apply to the newly created Generis Role. - * @param includedRoles The Role(s) to be included in the newly created Generis Role. Can be either a Resource or an array of Resources. + * @param string $label The label to apply to the newly created Generis Role. + * @param $includedRoles The Role(s) to be included in the newly created Generis Role. Can be either a Resource or + * an array of Resources. * @return core_kernel_classes_Resource */ public function addRole($label, $includedRoles = null, core_kernel_classes_Class $class = null) @@ -422,7 +437,8 @@ public function removeRole(core_kernel_classes_Resource $role) * * @param core_kernel_classes_Resource $role A Generis Role. * - * @return array An associative array where keys are Role URIs and values are instances of core_kernel_classes_Resource. + * @return array An associative array where keys are Role URIs and values are instances of + * core_kernel_classes_Resource. * @throws core_kernel_users_CacheException * @throws core_kernel_users_Exception */ @@ -566,9 +582,10 @@ public function unincludeRole(core_kernel_classes_Resource $role, core_kernel_cl * * @access public * @author Jerome Bogaerts, - * @param string login The login of the user. - * @param string password the md5 hash of the password. - * @param allowedRoles A Role or an array of Roles that are allowed to be logged in. If the user has a Role that matches one or more Roles in this array, the login request will be accepted. + * @param string $login The login of the user. + * @param string $password the md5 hash of the password. + * @param $allowedRoles - A role or an array of Roles that are allowed to be logged in. If the user has a Role that + * matches one or more Roles in this array, the login request will be accepted. * @return boolean */ public function login($login, $password, $allowedRoles) @@ -622,7 +639,8 @@ public function logout() /** * Returns the whole collection of Roles in Generis. * - * @return array An associative array where keys are Role URIs and values are instances of the core_kernel_classes_Resource PHP class. + * @return array An associative array where keys are Role URIs and values are instances of the + * core_kernel_classes_Resource PHP class. */ public function getAllRoles() { diff --git a/core/kernel/users/interface.RolesManagement.php b/core/kernel/users/interface.RolesManagement.php index c76defad8..3d7a91b04 100644 --- a/core/kernel/users/interface.RolesManagement.php +++ b/core/kernel/users/interface.RolesManagement.php @@ -39,8 +39,9 @@ interface core_kernel_users_RolesManagement * * @access public * @author Jerome Bogaerts, - * @param string label The label to apply to the newly created Generis Role. - * @param includedRoles The Role(s) to be included in the newly created Generis Role. Can be either a Resource or an array of Resources. + * @param string $label The label to apply to the newly created Generis Role. + * @param $includedRoles The Role(s) to be included in the newly created Generis Role. Can be either a Resource or + * an array of Resources. * @return core_kernel_classes_Resource */ public function addRole($label, $includedRoles = null, core_kernel_classes_Class $class = null); @@ -90,7 +91,8 @@ public function unincludeRole(core_kernel_classes_Resource $role, core_kernel_cl * * @access public * @author Jerome Bogaerts - * @return array An associative array where keys are Role URIs and values are instances of the core_kernel_classes_Resource class. + * @return array An associative array where keys are Role URIs and values are instances of the + * core_kernel_classes_Resource class. */ public function getAllRoles(); } diff --git a/core/user/AuthAdapter.php b/core/user/AuthAdapter.php index 3542fd954..c5ea230ca 100644 --- a/core/user/AuthAdapter.php +++ b/core/user/AuthAdapter.php @@ -91,7 +91,9 @@ public function authenticate() if ($this->hasOption(self::OPTION_PATTERN)) { if (preg_match($this->getOption(self::OPTION_PATTERN), $this->username) === 0) { - throw new core_kernel_users_InvalidLoginException("Invalid pattern for user '" . $this->username . "'."); + throw new core_kernel_users_InvalidLoginException( + "Invalid pattern for user '" . $this->username . "'." + ); } } @@ -103,7 +105,9 @@ public function authenticate() if (count($users) > 1) { // Multiple users matching - throw new common_exception_InconsistentData("Multiple Users found with the same login '" . $this->username . "'."); + throw new common_exception_InconsistentData( + "Multiple Users found with the same login '" . $this->username . "'." + ); } if (empty($users)) { // fake code execution to prevent timing attacks @@ -113,11 +117,15 @@ public function authenticate() throw new core_kernel_users_InvalidLoginException('Unknown user "' . $this->username . '"'); } // should never happen, added for integrity - throw new core_kernel_users_InvalidLoginException('Inexisting user did not fail password check, this should not happen'); + throw new core_kernel_users_InvalidLoginException( + 'Inexisting user did not fail password check, this should not happen' + ); } $userResource = current($users); - $hash = $userResource->getUniquePropertyValue(new core_kernel_classes_Property(GenerisRdf::PROPERTY_USER_PASSWORD)); + $hash = $userResource->getUniquePropertyValue( + new core_kernel_classes_Property(GenerisRdf::PROPERTY_USER_PASSWORD) + ); if (!core_kernel_users_Service::getPasswordHash()->verify($this->password, $hash)) { throw new core_kernel_users_InvalidLoginException('Invalid password for user "' . $this->username . '"'); } diff --git a/test/GenerisPhpUnitTestRunner.php b/test/GenerisPhpUnitTestRunner.php index 85afc3a42..f9fc25106 100755 --- a/test/GenerisPhpUnitTestRunner.php +++ b/test/GenerisPhpUnitTestRunner.php @@ -173,7 +173,9 @@ protected function restoreCache() public static function getTestSession() { if (!self::$connected) { - throw new common_exception_Error('Trying to retrieve TestSession without initialising it first via initTest()'); + throw new common_exception_Error( + 'Trying to retrieve TestSession without initialising it first via initTest()' + ); } $session = common_session_SessionManager::getSession(); if (!$session instanceof common_test_TestUserSession) { diff --git a/test/OntologyMockTrait.php b/test/OntologyMockTrait.php index 30eaceb1b..d6414d8a5 100644 --- a/test/OntologyMockTrait.php +++ b/test/OntologyMockTrait.php @@ -87,7 +87,9 @@ private function setupOntology(Ontology $onto) SessionService::SERVICE_ID => $this->getSessionServiceMock($session), EventManager::SERVICE_ID => $eventManager, LoggerService::SERVICE_ID => $this->prophesize(LoggerInterface::class)->reveal(), - UriProvider::SERVICE_ID => new Bin2HexUriProvider([Bin2HexUriProvider::OPTION_NAMESPACE => 'http://ontology.mock/bin2hex#']), + UriProvider::SERVICE_ID => new Bin2HexUriProvider([ + Bin2HexUriProvider::OPTION_NAMESPACE => 'http://ontology.mock/bin2hex#' + ]), SimpleCache::SERVICE_ID => new NoCache(), DriverConfigurationFeeder::SERVICE_ID => new DriverConfigurationFeeder(), EventAggregator::SERVICE_ID => $eventAggregator diff --git a/test/integration/ClassTest.php b/test/integration/ClassTest.php index b82b1b3e8..8ce1d18db 100755 --- a/test/integration/ClassTest.php +++ b/test/integration/ClassTest.php @@ -374,13 +374,31 @@ public function testGetInstancesPropertyValuesWithLiteralProperties() $class = new core_kernel_classes_Class(GenerisRdf::CLASS_GENERIS_RESOURCE); $subClass = $class->createSubClass('GetInstancesPropertyValuesClass', 'GetInstancesPropertyValues_Class'); // create a first property for this class - $p1 = core_kernel_classes_ClassFactory::createProperty($subClass, 'GetInstancesPropertyValues_Property1', 'GetInstancesPropertyValues_Property1', false, LOCAL_NAMESPACE . "#P1"); + $p1 = core_kernel_classes_ClassFactory::createProperty( + $subClass, + 'GetInstancesPropertyValues_Property1', + 'GetInstancesPropertyValues_Property1', + false, + LOCAL_NAMESPACE . "#P1" + ); $p1->setRange(new core_kernel_classes_Class(OntologyRdfs::RDFS_LITERAL)); // create a second property for this class - $p2 = core_kernel_classes_ClassFactory::createProperty($subClass, 'GetInstancesPropertyValues_Property2', 'GetInstancesPropertyValues_Property2', false, LOCAL_NAMESPACE . "#P2"); + $p2 = core_kernel_classes_ClassFactory::createProperty( + $subClass, + 'GetInstancesPropertyValues_Property2', + 'GetInstancesPropertyValues_Property2', + false, + LOCAL_NAMESPACE . "#P2" + ); $p2->setRange(new core_kernel_classes_Class(OntologyRdfs::RDFS_LITERAL)); // create a second property for this class - $p3 = core_kernel_classes_ClassFactory::createProperty($subClass, 'GetInstancesPropertyValues_Property3', 'GetInstancesPropertyValues_Property3', false, LOCAL_NAMESPACE . "#P3"); + $p3 = core_kernel_classes_ClassFactory::createProperty( + $subClass, + 'GetInstancesPropertyValues_Property3', + 'GetInstancesPropertyValues_Property3', + false, + LOCAL_NAMESPACE . "#P3" + ); $p2->setRange(new core_kernel_classes_Class(OntologyRdfs::RDFS_LITERAL)); // $i1 $i1 = $subClass->createInstance("i1", "i1"); @@ -488,13 +506,31 @@ public function testGetInstancesPropertyValuesWithResourceProperties() $class = new core_kernel_classes_Class(GenerisRdf::CLASS_GENERIS_RESOURCE); $subClass = $class->createSubClass('GetInstancesPropertyValuesClass', 'GetInstancesPropertyValues_Class'); // create a first property for this class - $p1 = core_kernel_classes_ClassFactory::createProperty($subClass, 'GetInstancesPropertyValues_Property1', 'GetInstancesPropertyValues_Property1', false, LOCAL_NAMESPACE . "#P1"); + $p1 = core_kernel_classes_ClassFactory::createProperty( + $subClass, + 'GetInstancesPropertyValues_Property1', + 'GetInstancesPropertyValues_Property1', + false, + LOCAL_NAMESPACE . "#P1" + ); $p1->setRange(new core_kernel_classes_Class(GenerisRdf::GENERIS_BOOLEAN)); // create a second property for this class - $p2 = core_kernel_classes_ClassFactory::createProperty($subClass, 'GetInstancesPropertyValues_Property2', 'GetInstancesPropertyValues_Property2', false, LOCAL_NAMESPACE . "#P2"); + $p2 = core_kernel_classes_ClassFactory::createProperty( + $subClass, + 'GetInstancesPropertyValues_Property2', + 'GetInstancesPropertyValues_Property2', + false, + LOCAL_NAMESPACE . "#P2" + ); $p1->setRange(new core_kernel_classes_Class(GenerisRdf::GENERIS_BOOLEAN)); // create a second property for this class - $p3 = core_kernel_classes_ClassFactory::createProperty($subClass, 'GetInstancesPropertyValues_Property3', 'GetInstancesPropertyValues_Property3', false, LOCAL_NAMESPACE . "#P3"); + $p3 = core_kernel_classes_ClassFactory::createProperty( + $subClass, + 'GetInstancesPropertyValues_Property3', + 'GetInstancesPropertyValues_Property3', + false, + LOCAL_NAMESPACE . "#P3" + ); $p1->setRange(new core_kernel_classes_Class(OntologyRdfs::RDFS_LITERAL)); // $i1 $i1 = $subClass->createInstance("i1", "i1"); @@ -536,7 +572,9 @@ public function testGetInstancesPropertyValuesWithResourceProperties() $result = $subClass->getInstancesPropertyValues($p2, $propertyFilters, ["distinct" => true]); $this->assertEquals(count($result), 2); foreach ($result as $property) { - $this->assertTrue($property->getUri() == GenerisRdf::GENERIS_TRUE || $property->getUri() == GenerisRdf::GENERIS_FALSE); + $this->assertTrue( + $property->getUri() == GenerisRdf::GENERIS_TRUE || $property->getUri() == GenerisRdf::GENERIS_FALSE + ); } // Search * P2 for P1=NotExistingProperty litteral WITH DISTINCT options @@ -584,7 +622,9 @@ public function testGetInstancesPropertyValuesWithResourceProperties() $result = $subClass->getInstancesPropertyValues($p2, $propertyFilters, ["distinct" => true]); $this->assertEquals(count($result), 2); foreach ($result as $property) { - $this->assertTrue($property->getUri() == GenerisRdf::GENERIS_TRUE || $property->getUri() == GenerisRdf::GENERIS_FALSE); + $this->assertTrue( + $property->getUri() == GenerisRdf::GENERIS_TRUE || $property->getUri() == GenerisRdf::GENERIS_FALSE + ); } // Clean the model diff --git a/test/integration/ComplexSearchTest.php b/test/integration/ComplexSearchTest.php index 5e8ae8384..5b6f6004b 100644 --- a/test/integration/ComplexSearchTest.php +++ b/test/integration/ComplexSearchTest.php @@ -34,7 +34,9 @@ protected function setUp(): void $this->object = new core_kernel_classes_Class(OntologyRdfs::RDFS_RESOURCE); $this->object->debug = __METHOD__; - $this->search = ServiceManager::getServiceManager()->get(\oat\generis\model\kernel\persistence\smoothsql\search\ComplexSearchService::SERVICE_ID); + $this->search = ServiceManager::getServiceManager()->get( + \oat\generis\model\kernel\persistence\smoothsql\search\ComplexSearchService::SERVICE_ID + ); } public function testRandomized() diff --git a/test/integration/CreateInstanceTest.php b/test/integration/CreateInstanceTest.php index ae4331909..69fe818e4 100755 --- a/test/integration/CreateInstanceTest.php +++ b/test/integration/CreateInstanceTest.php @@ -42,7 +42,10 @@ protected function setUp(): void { GenerisPhpUnitTestRunner::initTest(); - $classres = core_kernel_classes_ResourceFactory::create(new core_kernel_classes_Class(OntologyRdfs::RDFS_CLASS), 'TestClass'); + $classres = core_kernel_classes_ResourceFactory::create( + new core_kernel_classes_Class(OntologyRdfs::RDFS_CLASS), + 'TestClass' + ); $this->class = new core_kernel_classes_Class($classres->getUri()); $this->assertIsA($this->class, 'core_kernel_classes_Class'); $this->assertTrue($this->class->hasType(new core_kernel_classes_Class(OntologyRdfs::RDFS_CLASS))); @@ -80,9 +83,17 @@ public function testCreateInstanceWithProperties() // simple case, without params - $class = $this->class; - $litproperty = new core_kernel_classes_Property(core_kernel_classes_ResourceFactory::create(new core_kernel_classes_Class(OntologyRdf::RDF_PROPERTY))->getUri()); - $property = new core_kernel_classes_Property(core_kernel_classes_ResourceFactory::create(new core_kernel_classes_Class(OntologyRdf::RDF_PROPERTY))->getUri()); + $class = $this->class; + $litproperty = new core_kernel_classes_Property( + core_kernel_classes_ResourceFactory::create( + new core_kernel_classes_Class(OntologyRdf::RDF_PROPERTY) + )->getUri() + ); + $property = new core_kernel_classes_Property( + core_kernel_classes_ResourceFactory::create( + new core_kernel_classes_Class(OntologyRdf::RDF_PROPERTY) + )->getUri() + ); $instance = $class->createInstanceWithProperties([]); $this->assertTrue($instance->hasType($class)); @@ -137,9 +148,15 @@ public function testCreateInstanceWithProperties() $this->assertEquals($propActual, $propNormative); // multiple classes - $classres = core_kernel_classes_ResourceFactory::create(new core_kernel_classes_Class(OntologyRdfs::RDFS_CLASS), 'TestClass2'); + $classres = core_kernel_classes_ResourceFactory::create( + new core_kernel_classes_Class(OntologyRdfs::RDFS_CLASS), + 'TestClass2' + ); $class2 = new core_kernel_classes_Class($classres); - $classres = core_kernel_classes_ResourceFactory::create(new core_kernel_classes_Class(OntologyRdfs::RDFS_CLASS), 'TestClass3'); + $classres = core_kernel_classes_ResourceFactory::create( + new core_kernel_classes_Class(OntologyRdfs::RDFS_CLASS), + 'TestClass3' + ); $class3 = new core_kernel_classes_Class($classres); // 2 classes (by ressource) diff --git a/test/integration/DbWrapperTest.php b/test/integration/DbWrapperTest.php index b3bd008b4..8178295c8 100755 --- a/test/integration/DbWrapperTest.php +++ b/test/integration/DbWrapperTest.php @@ -44,7 +44,10 @@ protected function setUp(): void "uri" VARCHAR(255) NOT NULL, "coluMn1" VARCHAR(255) )'); for ($i = 0; $i < 4; $i++) { - $dbWrapper->exec('INSERT INTO "dbTestCase" (id,uri,"coluMn1") VALUES (?,?,?) ;', [$i,'http://uri' . $i,'value' . $i]); + $dbWrapper->exec( + 'INSERT INTO "dbTestCase" (id,uri,"coluMn1") VALUES (?,?,?) ;', + [$i,'http://uri' . $i,'value' . $i] + ); } } @@ -69,7 +72,10 @@ public function testGetColumnNames() $possibleValues = ['id','uri','coluMn1']; foreach ($columns as $col) { if ($col instanceof Doctrine\DBAL\Schema\Column) { - $this->assertTrue(in_array($col->getName(), $possibleValues), $col->getName() . ' is not a correct value'); + $this->assertTrue( + in_array($col->getName(), $possibleValues), + $col->getName() . ' is not a correct value' + ); } else { //legacy mode $this->assertTrue(in_array($col, $possibleValues)); @@ -134,7 +140,10 @@ public function testCreateIndex() $indexes = $dbWrapper->getSchemaManager()->getTableIndexes('dbtestcase2'); foreach ($indexes as $index) { - $this->assertTrue(in_array($index->getName(), ['idx_content','dbtestcase2_pkey','PRIMARY']), $index->getName() . 'is missing'); + $this->assertTrue( + in_array($index->getName(), ['idx_content','dbtestcase2_pkey','PRIMARY']), + $index->getName() . 'is missing' + ); } $dbWrapper->exec('DROP TABLE dbtestcase2'); diff --git a/test/integration/RdfExportTest.php b/test/integration/RdfExportTest.php index 1cd25c701..2efb29fcb 100755 --- a/test/integration/RdfExportTest.php +++ b/test/integration/RdfExportTest.php @@ -30,7 +30,10 @@ class RdfExportTest extends GenerisPhpUnitTestRunner public function testFullExport() { $dbWrapper = core_kernel_classes_DbWrapper::singleton(); - $result = $dbWrapper->query('SELECT count(*) as count FROM (SELECT DISTINCT subject, predicate, object, l_language FROM statements) as supercount')->fetch(); + $result = $dbWrapper->query( + 'SELECT count(*) as count FROM (SELECT DISTINCT subject, predicate, object, l_language FROM statements)' + . ' as supercount' + )->fetch(); $triples = $result['count']; diff --git a/test/integration/ResourceTest.php b/test/integration/ResourceTest.php index a5191ca0a..6f8e54512 100755 --- a/test/integration/ResourceTest.php +++ b/test/integration/ResourceTest.php @@ -108,7 +108,9 @@ public function testGetPropertyValuesCollection() foreach ($collection->getIterator() as $value) { $this->assertIsA($value, 'core_kernel_classes_Container'); if ($value instanceof core_kernel_classes_Resource) { - $this->assertTrue($value->getUri() == GenerisRdf::GENERIS_TRUE || $value->getUri() == GenerisRdf::GENERIS_FALSE); + $this->assertTrue( + $value->getUri() == GenerisRdf::GENERIS_TRUE || $value->getUri() == GenerisRdf::GENERIS_FALSE + ); } if ($value instanceof core_kernel_classes_Literal) { $this->assertEquals($value->literal, 'plop'); @@ -123,7 +125,9 @@ public function testGetPropertyValuesCollection() foreach ($collection->getIterator() as $value) { $this->assertIsA($value, 'core_kernel_classes_Container'); if ($value instanceof core_kernel_classes_Resource) { - $this->assertTrue($value->getUri() == GenerisRdf::GENERIS_TRUE || $value->getUri() == GenerisRdf::GENERIS_FALSE); + $this->assertTrue( + $value->getUri() == GenerisRdf::GENERIS_TRUE || $value->getUri() == GenerisRdf::GENERIS_FALSE + ); } if ($value instanceof core_kernel_classes_Literal) { $this->assertEquals($value->literal, 'plop'); @@ -138,10 +142,16 @@ public function testGetPropertyValuesCollection() foreach ($collection->getIterator() as $value) { $this->assertInstanceOf('core_kernel_classes_Container', $value); if ($value instanceof core_kernel_classes_Resource) { - $this->assertTrue($value->getUri() == GenerisRdf::GENERIS_TRUE, $value->getUri() . ' must be equal to ' . GenerisRdf::GENERIS_TRUE); + $this->assertTrue( + $value->getUri() == GenerisRdf::GENERIS_TRUE, + $value->getUri() . ' must be equal to ' . GenerisRdf::GENERIS_TRUE + ); } if ($value instanceof core_kernel_classes_Literal) { - $this->assertTrue($value->literal == 'plup' || $value->literal == 'plip', $value->literal . ' must be equal to plip or plop'); + $this->assertTrue( + $value->literal == 'plup' || $value->literal == 'plip', + $value->literal . ' must be equal to plip or plop' + ); } } @@ -165,7 +175,8 @@ public function testGetPropertiesValues() $resource->setPropertyValue($property2, 'prop2'); $resource->setPropertyValue($property3, 'prop3'); - //test that the get properties values is getting an array as parameter, if the parameter is not an array, the function will return an exception + // test that the get properties values is getting an array as parameter, if the parameter is not an array, the + // function will return an exception try { $resource->getPropertiesValues($property1); $this->assertTrue(false); @@ -289,7 +300,9 @@ public function testSetPropertyValue() foreach ($collection->getIterator() as $value) { $this->assertIsA($value, 'core_kernel_classes_Container'); if ($value instanceof core_kernel_classes_Resource) { - $this->assertTrue($value->getUri() == GenerisRdf::GENERIS_TRUE || $value->getUri() == GenerisRdf::GENERIS_FALSE); + $this->assertTrue( + $value->getUri() == GenerisRdf::GENERIS_TRUE || $value->getUri() == GenerisRdf::GENERIS_FALSE + ); } if ($value instanceof core_kernel_classes_Literal) { $this->assertEquals($value->literal, "&plop n'\"; plop'\' plop"); @@ -368,8 +381,12 @@ public function testGetPropertyValuesByLg() $this->assertTrue($collectionFr->count() == 2); $collectionEn = $instance->getPropertyValuesByLg($seeAlso, 'EN'); $this->assertTrue($collectionEn->count() == 1); - $this->assertTrue($collectionFr->get(0)->literal == 'vrai peut etre' || $collectionFr->get(0)->literal == 'vrai'); - $this->assertTrue($collectionFr->get(1)->literal == 'vrai peut etre' || $collectionFr->get(1)->literal == 'vrai'); + $this->assertTrue( + $collectionFr->get(0)->literal == 'vrai peut etre' || $collectionFr->get(0)->literal == 'vrai' + ); + $this->assertTrue( + $collectionFr->get(1)->literal == 'vrai peut etre' || $collectionFr->get(1)->literal == 'vrai' + ); $this->assertTrue($collectionEn->get(0)->literal == 'true'); $instance->delete(); $seeAlso->delete(); @@ -389,8 +406,12 @@ public function testSetPropertyValueByLg() $this->assertTrue($collectionFr->count() == 2); $collectionEn = $instance->getPropertyValuesByLg($seeAlso, 'EN'); $this->assertTrue($collectionEn->count() == 1); - $this->assertTrue($collectionFr->get(0)->literal == 'vrai peut etre' || $collectionFr->get(0)->literal == 'vrai'); - $this->assertTrue($collectionFr->get(1)->literal == 'vrai peut etre' || $collectionFr->get(1)->literal == 'vrai'); + $this->assertTrue( + $collectionFr->get(0)->literal == 'vrai peut etre' || $collectionFr->get(0)->literal == 'vrai' + ); + $this->assertTrue( + $collectionFr->get(1)->literal == 'vrai peut etre' || $collectionFr->get(1)->literal == 'vrai' + ); $this->assertTrue($collectionEn->get(0)->literal == 'true'); $instance->delete(); $seeAlso->delete(); @@ -733,7 +754,9 @@ public function testIsClass() public function testClone() { $this->expectException(common_exception_DeprecatedApiMethod::class); - $this->expectExceptionMessage('Use duplicated instead, because clone resource could not share same uri that original'); + $this->expectExceptionMessage( + 'Use duplicated instead, because clone resource could not share same uri that original' + ); $class = new core_kernel_classes_Class(GenerisRdf::GENERIS_BOOLEAN, __METHOD__); $instance = $class->createInstance('test', 'test'); $clone = clone $instance; diff --git a/test/integration/SqlInjectionTest.php b/test/integration/SqlInjectionTest.php index 2ef35d0a2..018dedc66 100644 --- a/test/integration/SqlInjectionTest.php +++ b/test/integration/SqlInjectionTest.php @@ -40,7 +40,10 @@ public function testInject() $testInstance->setPropertiesValues([ OntologyRdfs::RDFS_COMMENT => '"hi"' ]); - $this->assertEquals($testInstance->getUniquePropertyValue(new core_kernel_classes_Property(OntologyRdfs::RDFS_LABEL)), "\"hi\""); + $this->assertEquals( + $testInstance->getUniquePropertyValue(new core_kernel_classes_Property(OntologyRdfs::RDFS_LABEL)), + "\"hi\"" + ); } catch (DBALException $e) { $this->fail('SQL Error: ' . $e->getMessage()); } diff --git a/test/integration/UserServiceTest.php b/test/integration/UserServiceTest.php index f4fc2fd84..e005d08b1 100755 --- a/test/integration/UserServiceTest.php +++ b/test/integration/UserServiceTest.php @@ -67,7 +67,11 @@ public static function initRoles() $prefix = LOCAL_NAMESPACE . '#'; // Do not forget that more you go deep in the Roles hierarchy, more rights you have. - $baseRole = $roleClass->createInstance('BASE Role', 'The base role of the hierarchy (minimal rights).', $prefix . 'baseRole'); + $baseRole = $roleClass->createInstance( + 'BASE Role', + 'The base role of the hierarchy (minimal rights).', + $prefix . 'baseRole' + ); $baseRole->setPropertyValue($isSystemProperty, $falseInstance); $subRole1 = $roleClass->createInstance('SUB Role 1', 'Includes BASE role.', $prefix . 'subRole1'); @@ -90,7 +94,11 @@ public static function initRoles() $subRole12->setPropertyValue($includesRoleProperty, $subRole1); $subRole12->setPropertyValue($isSystemProperty, $falseInstance); - $subRole13 = $roleClass->createInstance('SUB Role 13', 'Includes SUB Role 1, SUB Role 11, SUB Role 12.', $prefix . 'subRole13'); + $subRole13 = $roleClass->createInstance( + 'SUB Role 13', + 'Includes SUB Role 1, SUB Role 11, SUB Role 12.', + $prefix . 'subRole13' + ); $subRole13->setPropertyValue($includesRoleProperty, $subRole1); $subRole13->setPropertyValue($includesRoleProperty, $subRole11); $subRole13->setPropertyValue($includesRoleProperty, $subRole12); @@ -463,7 +471,11 @@ public function testRolesCache() // Nothing is in the cache, we should get an exception. try { core_kernel_users_Cache::retrieveIncludedRoles($role); - $this->assertTrue(false, 'An exception should be raised when trying to retrieve included roles that are not yet in the cache memory.'); + $this->assertTrue( + false, + 'An exception should be raised when trying to retrieve included roles that are not yet in the ' + . 'cache memory.' + ); } catch (core_kernel_users_CacheException $e) { $this->assertTrue(true); } diff --git a/test/integration/common/filesystem/DirectoryFilesystemTest.php b/test/integration/common/filesystem/DirectoryFilesystemTest.php index 09b70d49e..5e04b8ddd 100644 --- a/test/integration/common/filesystem/DirectoryFilesystemTest.php +++ b/test/integration/common/filesystem/DirectoryFilesystemTest.php @@ -129,7 +129,9 @@ private function getTempDirectory() private function getMockFileSystem() { if ($this->fileSystemService === null) { - $this->fileSystemService = $this->getServiceLocatorMock([FileSystemService::SERVICE_ID => new FileSystemService()])->get(FileSystemService::SERVICE_ID); + $this->fileSystemService = $this + ->getServiceLocatorMock([FileSystemService::SERVICE_ID => new FileSystemService()]) + ->get(FileSystemService::SERVICE_ID); } return $this->fileSystemService; diff --git a/test/integration/helpers/FileSerializerMigrationHelperTest.php b/test/integration/helpers/FileSerializerMigrationHelperTest.php index c35711e26..1e072c44c 100644 --- a/test/integration/helpers/FileSerializerMigrationHelperTest.php +++ b/test/integration/helpers/FileSerializerMigrationHelperTest.php @@ -156,7 +156,9 @@ private function getFileResource() [ GenerisRdf::PROPERTY_FILE_FILENAME => $filename, GenerisRdf::PROPERTY_FILE_FILEPATH => $filePath, - GenerisRdf::PROPERTY_FILE_FILESYSTEM => $this->ontologyMock->getResource($this->testFile->getFileSystemId()), + GenerisRdf::PROPERTY_FILE_FILESYSTEM => $this->ontologyMock->getResource( + $this->testFile->getFileSystemId() + ), ] ); @@ -193,7 +195,9 @@ protected function tearDown(): void private function getMockFileSystem() { if ($this->fileSystemService === null) { - $this->fileSystemService = $this->getServiceLocatorMock([FileSystemService::SERVICE_ID => new FileSystemService()])->get(FileSystemService::SERVICE_ID); + $this->fileSystemService = $this + ->getServiceLocatorMock([FileSystemService::SERVICE_ID => new FileSystemService()]) + ->get(FileSystemService::SERVICE_ID); } return $this->fileSystemService; diff --git a/test/integration/helpers/FileTest.php b/test/integration/helpers/FileTest.php index e3c86b46f..dc53f5908 100644 --- a/test/integration/helpers/FileTest.php +++ b/test/integration/helpers/FileTest.php @@ -34,7 +34,8 @@ public function tearDown(): void public function setUp(): void { - $this->rootDir = uniqid(sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'test-file-inside-directory', true) . DIRECTORY_SEPARATOR; + $this->rootDir = uniqid(sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'test-file-inside-directory', true) + . DIRECTORY_SEPARATOR; mkdir($this->rootDir); mkdir($this->rootDir . 'directoryname'); @@ -63,6 +64,9 @@ public function fileInsideDirectoryDataProvider() */ public function testIsFileInsideDirectory($filename, $directoryName, bool $isInside) { - $this->assertEquals(\helpers_File::isFileInsideDirectory($filename, $this->rootDir . $directoryName), $isInside); + $this->assertEquals( + \helpers_File::isFileInsideDirectory($filename, $this->rootDir . $directoryName), + $isInside + ); } } diff --git a/test/integration/model/persistence/file/FileModelTest.php b/test/integration/model/persistence/file/FileModelTest.php index b80c35cbd..a00fb6bf1 100644 --- a/test/integration/model/persistence/file/FileModelTest.php +++ b/test/integration/model/persistence/file/FileModelTest.php @@ -127,7 +127,10 @@ public function testGetModelIdFromXml($id, $file) } catch (\Exception $e) { $this->assertInstanceOf('\common_exception_Error', $e); if ($id == 100) { - $this->assertContains('has to be defined with the "xml:base" attribute of the ROOT node', $e->getMessage()); + $this->assertContains( + 'has to be defined with the "xml:base" attribute of the ROOT node', + $e->getMessage() + ); } else { $this->fail('unexpected error'); } diff --git a/test/integration/model/persistence/smoothsql/SmoothsqlUtilsTest.php b/test/integration/model/persistence/smoothsql/SmoothsqlUtilsTest.php index dd75fd0f0..b83f43751 100644 --- a/test/integration/model/persistence/smoothsql/SmoothsqlUtilsTest.php +++ b/test/integration/model/persistence/smoothsql/SmoothsqlUtilsTest.php @@ -19,8 +19,8 @@ * (under the project TAO-TRANSFER); * 2009-2012 (update and modification) Public Research Centre Henri Tudor * (under the project TAO-SUSTAIN & TAO-DEV); - * 2012-2014 (update and modification) 2012-2014 (update and modification) Open Assessment Technologies SA (under the project TAO-PRODUCT); - * + * 2012-2014 (update and modification) 2012-2014 (update and modification) Open Assessment Technologies SA + * (under the project TAO-PRODUCT); */ namespace oat\generis\test\integration\model\persistence\smoothsql; @@ -58,7 +58,14 @@ public function __construct($name = null, array $data = [], $dataName = '') */ public function testBuildSearchPattern($pattern, $like, $expected) { - $this->assertSame($expected, core_kernel_persistence_smoothsql_Utils::buildSearchPattern($this->getModel()->getPersistence(), $pattern, $like)); + $this->assertSame( + $expected, + core_kernel_persistence_smoothsql_Utils::buildSearchPattern( + $this->getModel()->getPersistence(), + $pattern, + $like + ) + ); } public function buildSearchPatternProvider() @@ -76,8 +83,16 @@ public function buildSearchPatternProvider() [false, false, '= ' . $this->quote('')], [false, true, 'LIKE LOWER(' . $this->quote('%%') . ')'], ['', true, 'LIKE LOWER(' . $this->quote('%%') . ')'], - [new core_kernel_classes_Resource('http://www.13.com/ontology#toto'), false, '= ' . $this->quote('http://www.13.com/ontology#toto')], - [new core_kernel_classes_Resource('http://www.13.com/ontology#toto'), true, '= ' . $this->quote('http://www.13.com/ontology#toto')], + [ + new core_kernel_classes_Resource('http://www.13.com/ontology#toto'), + false, + '= ' . $this->quote('http://www.13.com/ontology#toto') + ], + [ + new core_kernel_classes_Resource('http://www.13.com/ontology#toto'), + true, + '= ' . $this->quote('http://www.13.com/ontology#toto') + ], ]; } @@ -91,7 +106,13 @@ public function buildSearchPatternProvider() */ public function testBuildPropertyQuery($expected, $propertyUri, $values, $like, $lang = '') { - $query = core_kernel_persistence_smoothsql_Utils::buildPropertyQuery($this->getModel(), $propertyUri, $values, $like, $lang); + $query = core_kernel_persistence_smoothsql_Utils::buildPropertyQuery( + $this->getModel(), + $propertyUri, + $values, + $like, + $lang + ); $queryWithoutModelRestrictions = substr($query, 0, strlen($expected)); $this->assertSame($expected, $queryWithoutModelRestrictions); $this->assertSame(' AND modelid IN (', substr($query, strlen($expected), strlen(' AND modelid IN ('))); @@ -101,25 +122,35 @@ public function buildPropertyQueryProvider() { return [ [ - "SELECT DISTINCT subject FROM statements WHERE (predicate = " . $this->quote('http://www.13.com/ontology#prop') . ") AND (object = " . $this->quote('hello') . ")", + "SELECT DISTINCT subject FROM statements WHERE (predicate = " + . $this->quote('http://www.13.com/ontology#prop') . ") AND (object = " + . $this->quote('hello') . ")", 'http://www.13.com/ontology#prop', 'hello', false ], [ - "SELECT DISTINCT subject FROM statements WHERE (predicate = " . $this->quote('http://www.13.com/ontology#prop') . ") AND (object = " . $this->quote('hello') . " OR object = " . $this->quote('world') . ")", + "SELECT DISTINCT subject FROM statements WHERE (predicate = " + . $this->quote('http://www.13.com/ontology#prop') . ") AND (object = " + . $this->quote('hello') . " OR object = " . $this->quote('world') . ")", 'http://www.13.com/ontology#prop', ['hello', 'world'], false ], [ - "SELECT DISTINCT subject FROM statements WHERE (predicate = " . $this->quote('http://www.13.com/ontology#prop') . ") AND (LOWER(object) LIKE LOWER(" . $this->quote('%hello%') . ") OR LOWER(object) LIKE LOWER(" . $this->quote('%world%') . "))", + "SELECT DISTINCT subject FROM statements WHERE (predicate = " + . $this->quote('http://www.13.com/ontology#prop') . ") AND (LOWER(object) LIKE LOWER(" + . $this->quote('%hello%') . ") OR LOWER(object) LIKE LOWER(" . $this->quote('%world%') + . "))", 'http://www.13.com/ontology#prop', ['hello', 'world'], true ], [ - "SELECT DISTINCT subject FROM statements WHERE (predicate = " . $this->quote('http://www.13.com/ontology#prop') . ") AND (object = " . $this->quote('hello') . " AND (l_language = " . $this->quote('') . " OR l_language = " . $this->quote('en-US') . "))", + "SELECT DISTINCT subject FROM statements WHERE (predicate = " + . $this->quote('http://www.13.com/ontology#prop') . ") AND (object = " + . $this->quote('hello') . " AND (l_language = " . $this->quote('') . " OR l_language = " + . $this->quote('en-US') . "))", 'http://www.13.com/ontology#prop', 'hello', false, @@ -144,16 +175,50 @@ public function buildUnionQueryProvider() return [ [ [ - core_kernel_persistence_smoothsql_Utils::buildPropertyQuery($this->getModel(), 'http://www.13.com/ontology#prop1', 'toto', false), - core_kernel_persistence_smoothsql_Utils::buildPropertyQuery($this->getModel(), 'http://www.13.com/ontology#prop2', 'tata', false), + core_kernel_persistence_smoothsql_Utils::buildPropertyQuery( + $this->getModel(), + 'http://www.13.com/ontology#prop1', + 'toto', + false + ), + core_kernel_persistence_smoothsql_Utils::buildPropertyQuery( + $this->getModel(), + 'http://www.13.com/ontology#prop2', + 'tata', + false + ), ], - '(' . core_kernel_persistence_smoothsql_Utils::buildPropertyQuery($this->getModel(), 'http://www.13.com/ontology#prop1', 'toto', false) . ') UNION ALL (' . core_kernel_persistence_smoothsql_Utils::buildPropertyQuery($this->getModel(), 'http://www.13.com/ontology#prop2', 'tata', false) . ')' + '(' + . core_kernel_persistence_smoothsql_Utils::buildPropertyQuery( + $this->getModel(), + 'http://www.13.com/ontology#prop1', + 'toto', + false + ) + . ') UNION ALL (' + . core_kernel_persistence_smoothsql_Utils::buildPropertyQuery( + $this->getModel(), + 'http://www.13.com/ontology#prop2', + 'tata', + false + ) + . ')' ], [ [ - core_kernel_persistence_smoothsql_Utils::buildPropertyQuery($this->getModel(), 'http://www.13.com/ontology#prop1', 'toto', false) + core_kernel_persistence_smoothsql_Utils::buildPropertyQuery( + $this->getModel(), + 'http://www.13.com/ontology#prop1', + 'toto', + false + ) ], - core_kernel_persistence_smoothsql_Utils::buildPropertyQuery($this->getModel(), 'http://www.13.com/ontology#prop1', 'toto', false) + core_kernel_persistence_smoothsql_Utils::buildPropertyQuery( + $this->getModel(), + 'http://www.13.com/ontology#prop1', + 'toto', + false + ) ], [[], false] ]; diff --git a/test/integration/mutex/LockServiceTest.php b/test/integration/mutex/LockServiceTest.php index 995924d58..1744162d9 100644 --- a/test/integration/mutex/LockServiceTest.php +++ b/test/integration/mutex/LockServiceTest.php @@ -44,10 +44,22 @@ public function testLock() $actionId2 = 'action_2'; $sleep = 3; $time = time(); - $pipe1 = popen('php ' . __DIR__ . DIRECTORY_SEPARATOR . 'test_action.php ' . $actionId1 . ' ' . $sleep . ' 0', 'w'); - $pipe2 = popen('php ' . __DIR__ . DIRECTORY_SEPARATOR . 'test_action.php ' . $actionId1 . ' ' . $sleep . ' 0', 'w'); - $pipe3 = popen('php ' . __DIR__ . DIRECTORY_SEPARATOR . 'test_action.php ' . $actionId1 . ' ' . $sleep . ' 0', 'w'); - $pipe4 = popen('php ' . __DIR__ . DIRECTORY_SEPARATOR . 'test_action.php ' . $actionId2 . ' ' . $sleep . ' 0', 'w'); + $pipe1 = popen( + 'php ' . __DIR__ . DIRECTORY_SEPARATOR . 'test_action.php ' . $actionId1 . ' ' . $sleep . ' 0', + 'w' + ); + $pipe2 = popen( + 'php ' . __DIR__ . DIRECTORY_SEPARATOR . 'test_action.php ' . $actionId1 . ' ' . $sleep . ' 0', + 'w' + ); + $pipe3 = popen( + 'php ' . __DIR__ . DIRECTORY_SEPARATOR . 'test_action.php ' . $actionId1 . ' ' . $sleep . ' 0', + 'w' + ); + $pipe4 = popen( + 'php ' . __DIR__ . DIRECTORY_SEPARATOR . 'test_action.php ' . $actionId2 . ' ' . $sleep . ' 0', + 'w' + ); pclose($pipe1); pclose($pipe2); pclose($pipe3); @@ -66,8 +78,14 @@ public function testLockTimeout() $sleep = 5; $timeout = 2; $time = time(); - $pipe1 = popen('php ' . __DIR__ . DIRECTORY_SEPARATOR . 'test_action.php ' . $actionId1 . ' ' . $sleep . ' ' . $timeout, 'w'); - $pipe2 = popen('php ' . __DIR__ . DIRECTORY_SEPARATOR . 'test_action.php ' . $actionId1 . ' ' . $sleep . ' ' . $timeout, 'w'); + $pipe1 = popen( + 'php ' . __DIR__ . DIRECTORY_SEPARATOR . 'test_action.php ' . $actionId1 . ' ' . $sleep . ' ' . $timeout, + 'w' + ); + $pipe2 = popen( + 'php ' . __DIR__ . DIRECTORY_SEPARATOR . 'test_action.php ' . $actionId1 . ' ' . $sleep . ' ' . $timeout, + 'w' + ); pclose($pipe1); pclose($pipe2); diff --git a/test/integration/rules/ExpressionFactoryTest.php b/test/integration/rules/ExpressionFactoryTest.php index fa9711666..8859c8f66 100644 --- a/test/integration/rules/ExpressionFactoryTest.php +++ b/test/integration/rules/ExpressionFactoryTest.php @@ -41,7 +41,10 @@ public function testCreateTerminalExpression() { $constantResource = core_kernel_rules_TermFactory::createConst('test1'); $terminalExpression = core_kernel_rules_ExpressionFactory::createTerminalExpression($constantResource); - $terminalExpressionProperty = new core_kernel_classes_Property(RulesRdf::PROPERTY_TERMINAL_EXPRESSION, __METHOD__); + $terminalExpressionProperty = new core_kernel_classes_Property( + RulesRdf::PROPERTY_TERMINAL_EXPRESSION, + __METHOD__ + ); $terminalExpressionVal = $terminalExpression->getOnePropertyValue($terminalExpressionProperty); $this->assertIsA($terminalExpressionVal, 'core_kernel_classes_Resource'); $this->assertEquals($terminalExpressionVal->getUri(), $constantResource->getUri()); @@ -63,10 +66,17 @@ public function testCreateRecursiveExpression() $terminalExpression2 = core_kernel_rules_ExpressionFactory::createTerminalExpression($constantResource2); $equalsOperator = new core_kernel_classes_Resource(RulesRdf::INSTANCE_EQUALS_OPERATOR_URI); - $finalExpression = core_kernel_rules_ExpressionFactory::createRecursiveExpression($terminalExpression1, $terminalExpression2, $equalsOperator); + $finalExpression = core_kernel_rules_ExpressionFactory::createRecursiveExpression( + $terminalExpression1, + $terminalExpression2, + $equalsOperator + ); //prop - $terminalExpressionProperty = new core_kernel_classes_Property(RulesRdf::PROPERTY_TERMINAL_EXPRESSION, __METHOD__); + $terminalExpressionProperty = new core_kernel_classes_Property( + RulesRdf::PROPERTY_TERMINAL_EXPRESSION, + __METHOD__ + ); $logicalOperatorProperty = new core_kernel_classes_Property(RulesRdf::PROPERTY_HASLOGICALOPERATOR, __METHOD__); $firstExpressionProperty = new core_kernel_classes_Property(RulesRdf::PROPERTY_FIRST_EXPRESSION, __METHOD__); $secondExpressionProperty = new core_kernel_classes_Property(RulesRdf::PROPERTY_SECOND_EXPRESSION, __METHOD__); diff --git a/test/integration/rules/ExpressionTest.php b/test/integration/rules/ExpressionTest.php index b8d1d3825..fc3599da3 100644 --- a/test/integration/rules/ExpressionTest.php +++ b/test/integration/rules/ExpressionTest.php @@ -53,143 +53,263 @@ public function testEvaluate() // test1 == test2 $equalsOperator = new core_kernel_classes_Resource(RulesRdf::INSTANCE_EQUALS_OPERATOR_URI); - $finalExpression = core_kernel_rules_ExpressionFactory::createRecursiveExpression($terminalExpression1, $terminalExpression2, $equalsOperator); + $finalExpression = core_kernel_rules_ExpressionFactory::createRecursiveExpression( + $terminalExpression1, + $terminalExpression2, + $equalsOperator + ); $this->assertFalse($finalExpression->evaluate()); $finalExpression->delete(); // 12 == 12 - $finalExpression = core_kernel_rules_ExpressionFactory::createRecursiveExpression($terminalExpression12, $terminalExpression12b, $equalsOperator); + $finalExpression = core_kernel_rules_ExpressionFactory::createRecursiveExpression( + $terminalExpression12, + $terminalExpression12b, + $equalsOperator + ); $this->assertTrue($finalExpression->evaluate()); $finalExpression->delete(); // test1 != test2 $diffOperator = new core_kernel_classes_Resource(RulesRdf::INSTANCE_DIFFERENT_OPERATOR_URI); - $finalExpression = core_kernel_rules_ExpressionFactory::createRecursiveExpression($terminalExpression1, $terminalExpression2, $diffOperator); + $finalExpression = core_kernel_rules_ExpressionFactory::createRecursiveExpression( + $terminalExpression1, + $terminalExpression2, + $diffOperator + ); $this->assertTrue($finalExpression->evaluate()); $finalExpression->delete(); // 12 != 12 - $finalExpression = core_kernel_rules_ExpressionFactory::createRecursiveExpression($terminalExpression12, $terminalExpression12b, $diffOperator); + $finalExpression = core_kernel_rules_ExpressionFactory::createRecursiveExpression( + $terminalExpression12, + $terminalExpression12b, + $diffOperator + ); $this->assertFalse($finalExpression->evaluate()); $finalExpression->delete(); // 14 <= 12 $infEqOperator = new core_kernel_classes_Resource(RulesRdf::INSTANCE_INF_EQ_OPERATOR_URI); - $finalExpression = core_kernel_rules_ExpressionFactory::createRecursiveExpression($terminalExpression14, $terminalExpression12, $infEqOperator); + $finalExpression = core_kernel_rules_ExpressionFactory::createRecursiveExpression( + $terminalExpression14, + $terminalExpression12, + $infEqOperator + ); $this->assertFalse($finalExpression->evaluate()); $finalExpression->delete(); //12 <= 14 - $finalExpression = core_kernel_rules_ExpressionFactory::createRecursiveExpression($terminalExpression12, $terminalExpression14, $infEqOperator); + $finalExpression = core_kernel_rules_ExpressionFactory::createRecursiveExpression( + $terminalExpression12, + $terminalExpression14, + $infEqOperator + ); $this->assertTrue($finalExpression->evaluate()); $finalExpression->delete(); //12 <= 12 - $finalExpression = core_kernel_rules_ExpressionFactory::createRecursiveExpression($terminalExpression12, $terminalExpression12b, $infEqOperator); + $finalExpression = core_kernel_rules_ExpressionFactory::createRecursiveExpression( + $terminalExpression12, + $terminalExpression12b, + $infEqOperator + ); $this->assertTrue($finalExpression->evaluate()); $finalExpression->delete(); // 14 >= 12 $supEqOperator = new core_kernel_classes_Resource(RulesRdf::INSTANCE_SUP_EQ_OPERATOR_URI); - $finalExpression = core_kernel_rules_ExpressionFactory::createRecursiveExpression($terminalExpression14, $terminalExpression12, $supEqOperator); + $finalExpression = core_kernel_rules_ExpressionFactory::createRecursiveExpression( + $terminalExpression14, + $terminalExpression12, + $supEqOperator + ); $this->assertTrue($finalExpression->evaluate()); $finalExpression->delete(); //12 >= 14 - $finalExpression = core_kernel_rules_ExpressionFactory::createRecursiveExpression($terminalExpression12, $terminalExpression14, $supEqOperator); + $finalExpression = core_kernel_rules_ExpressionFactory::createRecursiveExpression( + $terminalExpression12, + $terminalExpression14, + $supEqOperator + ); $this->assertFalse($finalExpression->evaluate()); $finalExpression->delete(); //12 >= 12 - $finalExpression = core_kernel_rules_ExpressionFactory::createRecursiveExpression($terminalExpression12, $terminalExpression12b, $supEqOperator); + $finalExpression = core_kernel_rules_ExpressionFactory::createRecursiveExpression( + $terminalExpression12, + $terminalExpression12b, + $supEqOperator + ); $this->assertTrue($finalExpression->evaluate()); $finalExpression->delete(); // 14 < 12 $infOperator = new core_kernel_classes_Resource(RulesRdf::INSTANCE_INF_OPERATOR_URI); - $finalExpression = core_kernel_rules_ExpressionFactory::createRecursiveExpression($terminalExpression14, $terminalExpression12, $infOperator); + $finalExpression = core_kernel_rules_ExpressionFactory::createRecursiveExpression( + $terminalExpression14, + $terminalExpression12, + $infOperator + ); $this->assertFalse($finalExpression->evaluate()); $finalExpression->delete(); //12 < 14 - $finalExpression = core_kernel_rules_ExpressionFactory::createRecursiveExpression($terminalExpression12, $terminalExpression14, $infOperator); + $finalExpression = core_kernel_rules_ExpressionFactory::createRecursiveExpression( + $terminalExpression12, + $terminalExpression14, + $infOperator + ); $this->assertTrue($finalExpression->evaluate()); $finalExpression->delete(); //12 < 12 - $finalExpression = core_kernel_rules_ExpressionFactory::createRecursiveExpression($terminalExpression12, $terminalExpression12b, $infOperator); + $finalExpression = core_kernel_rules_ExpressionFactory::createRecursiveExpression( + $terminalExpression12, + $terminalExpression12b, + $infOperator + ); $this->assertFalse($finalExpression->evaluate()); $finalExpression->delete(); // 14 > 12 $supOperator = new core_kernel_classes_Resource(RulesRdf::INSTANCE_SUP_OPERATOR_URI); - $finalExpression = core_kernel_rules_ExpressionFactory::createRecursiveExpression($terminalExpression14, $terminalExpression12, $supOperator); + $finalExpression = core_kernel_rules_ExpressionFactory::createRecursiveExpression( + $terminalExpression14, + $terminalExpression12, + $supOperator + ); $this->assertTrue($finalExpression->evaluate()); $finalExpression->delete(); //12 > 14 - $finalExpression = core_kernel_rules_ExpressionFactory::createRecursiveExpression($terminalExpression12, $terminalExpression14, $supOperator); + $finalExpression = core_kernel_rules_ExpressionFactory::createRecursiveExpression( + $terminalExpression12, + $terminalExpression14, + $supOperator + ); $this->assertFalse($finalExpression->evaluate()); $finalExpression->delete(); //12 > 12 - $finalExpression = core_kernel_rules_ExpressionFactory::createRecursiveExpression($terminalExpression12, $terminalExpression12b, $supOperator); + $finalExpression = core_kernel_rules_ExpressionFactory::createRecursiveExpression( + $terminalExpression12, + $terminalExpression12b, + $supOperator + ); $this->assertFalse($finalExpression->evaluate()); $finalExpression->delete(); // trueExpression => 12 < 14 - $trueExpression = core_kernel_rules_ExpressionFactory::createRecursiveExpression($terminalExpression12, $terminalExpression14, $infOperator); + $trueExpression = core_kernel_rules_ExpressionFactory::createRecursiveExpression( + $terminalExpression12, + $terminalExpression14, + $infOperator + ); //falseExpression => test1 == test2 - $falseExpression = core_kernel_rules_ExpressionFactory::createRecursiveExpression($terminalExpression1, $terminalExpression2, $equalsOperator); + $falseExpression = core_kernel_rules_ExpressionFactory::createRecursiveExpression( + $terminalExpression1, + $terminalExpression2, + $equalsOperator + ); // trueExpression2 => test1 != test2 - $trueExpression2 = core_kernel_rules_ExpressionFactory::createRecursiveExpression($terminalExpression1, $terminalExpression2, $diffOperator); + $trueExpression2 = core_kernel_rules_ExpressionFactory::createRecursiveExpression( + $terminalExpression1, + $terminalExpression2, + $diffOperator + ); //falseExpression2 => 14 < 12 - $falseExpression2 = core_kernel_rules_ExpressionFactory::createRecursiveExpression($terminalExpression14, $terminalExpression12, $infOperator); + $falseExpression2 = core_kernel_rules_ExpressionFactory::createRecursiveExpression( + $terminalExpression14, + $terminalExpression12, + $infOperator + ); // 12 < 14 AND test1 == test2 $andOperator = new core_kernel_classes_Resource(RulesRdf::INSTANCE_AND_OPERATOR); - $finalExpression = core_kernel_rules_ExpressionFactory::createRecursiveExpression($trueExpression, $falseExpression, $andOperator); + $finalExpression = core_kernel_rules_ExpressionFactory::createRecursiveExpression( + $trueExpression, + $falseExpression, + $andOperator + ); $this->assertFalse($finalExpression->evaluate()); $finalExpression->delete(); // 12 < 14 AND test1 != test2 - $finalExpression = core_kernel_rules_ExpressionFactory::createRecursiveExpression($trueExpression, $trueExpression2, $andOperator); + $finalExpression = core_kernel_rules_ExpressionFactory::createRecursiveExpression( + $trueExpression, + $trueExpression2, + $andOperator + ); $this->assertTrue($finalExpression->evaluate()); $finalExpression->delete(); // 12 < 14 OR test1 == test2 $orOperator = new core_kernel_classes_Resource(RulesRdf::INSTANCE_OR_OPERATOR); - $finalExpression = core_kernel_rules_ExpressionFactory::createRecursiveExpression($trueExpression, $falseExpression, $orOperator); + $finalExpression = core_kernel_rules_ExpressionFactory::createRecursiveExpression( + $trueExpression, + $falseExpression, + $orOperator + ); $this->assertTrue($finalExpression->evaluate()); $finalExpression->delete(); // 12 < 14 OR test1 != test2 - $finalExpression = core_kernel_rules_ExpressionFactory::createRecursiveExpression($trueExpression, $trueExpression2, $orOperator); + $finalExpression = core_kernel_rules_ExpressionFactory::createRecursiveExpression( + $trueExpression, + $trueExpression2, + $orOperator + ); $this->assertTrue($finalExpression->evaluate()); $finalExpression->delete(); // test1 == test2 OR 12 < 14 - $finalExpression = core_kernel_rules_ExpressionFactory::createRecursiveExpression($falseExpression, $trueExpression, $orOperator); + $finalExpression = core_kernel_rules_ExpressionFactory::createRecursiveExpression( + $falseExpression, + $trueExpression, + $orOperator + ); $this->assertTrue($finalExpression->evaluate()); $finalExpression->delete(); // test1 == test2 OR 14 < 12 - $finalExpression = core_kernel_rules_ExpressionFactory::createRecursiveExpression($falseExpression, $falseExpression2, $orOperator); + $finalExpression = core_kernel_rules_ExpressionFactory::createRecursiveExpression( + $falseExpression, + $falseExpression2, + $orOperator + ); $this->assertFalse($finalExpression->evaluate()); $finalExpression->delete(); // (test1 == test2 OR 14 < 12) AND (12 < 14 OR test1 == test2) - $finalExpression1 = core_kernel_rules_ExpressionFactory::createRecursiveExpression($falseExpression, $falseExpression2, $orOperator); - $finalExpression2 = core_kernel_rules_ExpressionFactory::createRecursiveExpression($trueExpression, $falseExpression, $orOperator); - $finalExpression = core_kernel_rules_ExpressionFactory::createRecursiveExpression($finalExpression1, $finalExpression2, $andOperator); + $finalExpression1 = core_kernel_rules_ExpressionFactory::createRecursiveExpression( + $falseExpression, + $falseExpression2, + $orOperator + ); + $finalExpression2 = core_kernel_rules_ExpressionFactory::createRecursiveExpression( + $trueExpression, + $falseExpression, + $orOperator + ); + $finalExpression = core_kernel_rules_ExpressionFactory::createRecursiveExpression( + $finalExpression1, + $finalExpression2, + $andOperator + ); $this->assertFalse($finalExpression->evaluate()); $finalExpression->delete(); // (test1 == test2 OR 14 < 12) OR (12 < 14 OR test1 == test2) - $finalExpression = core_kernel_rules_ExpressionFactory::createRecursiveExpression($finalExpression1, $finalExpression2, $orOperator); + $finalExpression = core_kernel_rules_ExpressionFactory::createRecursiveExpression( + $finalExpression1, + $finalExpression2, + $orOperator + ); $this->assertTrue($finalExpression->evaluate()); $finalExpression->delete(); diff --git a/test/integration/rules/TermFactoryTest.php b/test/integration/rules/TermFactoryTest.php index 0c74ebb5e..c11a31527 100644 --- a/test/integration/rules/TermFactoryTest.php +++ b/test/integration/rules/TermFactoryTest.php @@ -70,7 +70,10 @@ public function testCreateSPX() $booleanClass = new core_kernel_classes_Class(GenerisRdf::GENERIS_BOOLEAN); $maybe = core_kernel_classes_ResourceFactory::create($booleanClass, 'testCase testCreateSPX', __METHOD__); - $SPXResource = core_kernel_rules_TermFactory::createSPX($maybe, new core_kernel_classes_Property(OntologyRdfs::RDFS_COMMENT)); + $SPXResource = core_kernel_rules_TermFactory::createSPX( + $maybe, + new core_kernel_classes_Property(OntologyRdfs::RDFS_COMMENT) + ); $this->assertIsA($SPXResource, 'core_kernel_rules_Term'); $subjectProperty = new core_kernel_classes_Property(RulesRdf::PROPERTY_TERM_SPX_SUBJET); diff --git a/test/integration/rules/TermTest.php b/test/integration/rules/TermTest.php index ee706be75..98ed5adfa 100644 --- a/test/integration/rules/TermTest.php +++ b/test/integration/rules/TermTest.php @@ -67,7 +67,10 @@ public function testEvaluate() $booleanClass = new core_kernel_classes_Class(GenerisRdf::GENERIS_BOOLEAN); $maybe = core_kernel_classes_ResourceFactory::create($booleanClass, 'testCase testCreateSPX', __METHOD__); - $SPXResource = core_kernel_rules_TermFactory::createSPX($maybe, new core_kernel_classes_Property(OntologyRdfs::RDFS_COMMENT)); + $SPXResource = core_kernel_rules_TermFactory::createSPX( + $maybe, + new core_kernel_classes_Property(OntologyRdfs::RDFS_COMMENT) + ); $spxResult = $SPXResource->evaluate(); $this->assertIsA($spxResult, 'core_kernel_classes_Literal'); $this->assertEquals($spxResult, __METHOD__); diff --git a/test/samples/manifests/complexManifest.php b/test/samples/manifests/complexManifest.php index 92585b34c..6a5ef3da3 100644 --- a/test/samples/manifests/complexManifest.php +++ b/test/samples/manifests/complexManifest.php @@ -45,8 +45,23 @@ ['type' => 'CheckPHPExtension', 'value' => ['id' => 'ext_pdo', 'name' => 'PDO']], ['type' => 'CheckPHPExtension', 'value' => ['id' => 'ext_svn','name' => 'svn', 'optional' => true]], ['type' => 'CheckPHPExtension', 'value' => ['id' => 'ext_suhosin','name' => 'suhosin', 'optional' => true]], - ['type' => 'CheckPHPINIValue', 'value' => ['id' => 'ini_register_globals', 'name' => 'register_globals', 'value' => "0"]], - ['type' => 'CheckFileSystemComponent', 'value' => ['id' => 'fs_root','location' => '.', 'rights' => 'rw', 'name' => 'fs_root']], + [ + 'type' => 'CheckPHPINIValue', + 'value' => [ + 'id' => 'ini_register_globals', + 'name' => 'register_globals', + 'value' => "0" + ] + ], + [ + 'type' => 'CheckFileSystemComponent', + 'value' => [ + 'id' => 'fs_root', + 'location' => '.', + 'rights' => 'rw', + 'name' => 'fs_root' + ] + ], ] ], 'constants' => [ diff --git a/test/unit/ConfigurationTest.php b/test/unit/ConfigurationTest.php index 4b19f3c55..00a3837b9 100755 --- a/test/unit/ConfigurationTest.php +++ b/test/unit/ConfigurationTest.php @@ -40,7 +40,11 @@ class ConfigurationTest extends TestCase public function testPhPConstant() { - $this->assertNotEquals(PHP_MAJOR_VERSION, self::UNSUPPORTED_PHP_MAJOR_VERSION, 'Current php major version equals our assummed unsupported php version'); + $this->assertNotEquals( + PHP_MAJOR_VERSION, + self::UNSUPPORTED_PHP_MAJOR_VERSION, + 'Current php major version equals our assummed unsupported php version' + ); } public function testPHPIniValues() @@ -280,7 +284,10 @@ public function testSimpleComponentCollection() $reports = $collection->check(); $this->assertTrue(true); // Acyclic graph, no CyclicDependencyException thrown. $this->assertEquals(count($reports), 4); - $this->assertEquals($collection->getCheckedComponents(), [$componentA, $componentB, $componentC, $componentD]); + $this->assertEquals( + $collection->getCheckedComponents(), + [$componentA, $componentB, $componentC, $componentD] + ); $this->assertEquals($collection->getUncheckedComponents(), []); try { @@ -292,7 +299,10 @@ public function testSimpleComponentCollection() $this->assertTrue(true); $this->assertEquals($collection->getReports(), []); $this->assertEquals($collection->getCheckedComponents(), []); - $this->assertEquals($collection->getUncheckedComponents(), [$componentA, $componentB, $componentC, $componentD]); + $this->assertEquals( + $collection->getUncheckedComponents(), + [$componentA, $componentB, $componentC, $componentD] + ); // Finally, we test a ComponentCollection reset. $collection->reset(); diff --git a/test/unit/FileHelperTest.php b/test/unit/FileHelperTest.php index b20465ccb..8fba71ee2 100755 --- a/test/unit/FileHelperTest.php +++ b/test/unit/FileHelperTest.php @@ -60,7 +60,8 @@ private function mkdir($basePath) /** * @todo fix problematic test case - * why does this case try to read files 'ExpressionFactoryTest.php', 'ExpressionTest.php', 'OperationFactoryTest.php', 'OperationTest.php', 'TermFactoryTest.php', 'TermTest.php'? + * why does this case try to read files 'ExpressionFactoryTest.php', 'ExpressionTest.php', + * 'OperationFactoryTest.php', 'OperationTest.php', 'TermFactoryTest.php', 'TermTest.php'? * * * @dataProvider scandirDataProvider @@ -72,7 +73,10 @@ private function mkdir($basePath) */ public function testScandir($toScan, $expectedResult, $recursive = false, $absolute = false) { - $result = helpers_File::scanDir($toScan, ['recursive' => $recursive, 'absolute' => $absolute, 'only' => helpers_File::SCAN_FILE]); + $result = helpers_File::scanDir( + $toScan, + ['recursive' => $recursive, 'absolute' => $absolute, 'only' => helpers_File::SCAN_FILE] + ); $this->assertEquals(count($expectedResult), count($result)); // The order might vary depending on the file system implementation... foreach ($expectedResult as $expected) { @@ -124,7 +128,8 @@ public function containsFileTypeProvider() public function testUrlToPath() { - $path = DIRECTORY_SEPARATOR . 'style' . DIRECTORY_SEPARATOR . 'custom' . DIRECTORY_SEPARATOR . 'tao-user-styles.css'; + $path = DIRECTORY_SEPARATOR . 'style' . DIRECTORY_SEPARATOR . 'custom' . DIRECTORY_SEPARATOR + . 'tao-user-styles.css'; $urls = [ '/style/custom/tao-user-styles.css', diff --git a/test/unit/ManifestTest.php b/test/unit/ManifestTest.php index b39bd8224..3d2ab0a60 100755 --- a/test/unit/ManifestTest.php +++ b/test/unit/ManifestTest.php @@ -96,6 +96,12 @@ public function testManifestLoading() ], $manifest->getInstallModelFiles() ); - $this->assertEquals(['WS_ENDPOINT_TWITTER' => 'http://twitter.com/statuses/', 'WS_ENDPOINT_FACEBOOK' => 'http://api.facebook.com/restserver.php'], $manifest->getConstants()); + $this->assertEquals( + [ + 'WS_ENDPOINT_TWITTER' => 'http://twitter.com/statuses/', + 'WS_ENDPOINT_FACEBOOK' => 'http://api.facebook.com/restserver.php' + ], + $manifest->getConstants() + ); } } diff --git a/test/unit/UtilsTest.php b/test/unit/UtilsTest.php index 6e00852c8..e79dd9076 100755 --- a/test/unit/UtilsTest.php +++ b/test/unit/UtilsTest.php @@ -105,6 +105,23 @@ private function buildBinString() $score = "\x01" . pack('S', 8) . "\x00" . "\x01" . pack('d', 1.0); $response = "\x00" . pack('S', 0) . "\x00" . "\x01" . pack('S', 7) . 'ChoiceA'; - return implode('', [$position, $state, $navigationMode, $submissionMode, $attempting, $hasItemSessionControl, $numAttempts, $duration, $completionStatus, $timeReference, $varCount, $score, $response]); + return implode( + '', + [ + $position, + $state, + $navigationMode, + $submissionMode, + $attempting, + $hasItemSessionControl, + $numAttempts, + $duration, + $completionStatus, + $timeReference, + $varCount, + $score, + $response + ] + ); } } diff --git a/test/unit/common/configuration/ComponentFactoryTest.php b/test/unit/common/configuration/ComponentFactoryTest.php index f30f5779b..3688eaa55 100644 --- a/test/unit/common/configuration/ComponentFactoryTest.php +++ b/test/unit/common/configuration/ComponentFactoryTest.php @@ -129,16 +129,35 @@ public function testBuildFromArray() $output = $this->subject->buildFromArray(['type' => 'PHPRuntime', 'value' => ['min' => 1, 'max' => 2]]); $this->assertInstanceOf(common_configuration_PHPRuntime::class, $output); - $output = $this->subject->buildFromArray(['type' => 'PHPINIValue', 'value' => ['name' => 'name', 'value' => 'value']]); + $output = $this->subject->buildFromArray([ + 'type' => 'PHPINIValue', + 'value' => [ + 'name' => 'name', + 'value' => 'value' + ] + ]); $this->assertInstanceOf(common_configuration_PHPINIValue::class, $output); - $output = $this->subject->buildFromArray(['type' => 'PHPExtension', 'value' => ['name' => 'name', 'min' => 1, 'max' => 2]]); + $output = $this->subject->buildFromArray([ + 'type' => 'PHPExtension', + 'value' => [ + 'name' => 'name', + 'min' => 1, + 'max' => 2 + ] + ]); $this->assertInstanceOf(common_configuration_PHPExtension::class, $output); $output = $this->subject->buildFromArray(['type' => 'PHPDatabaseDriver', 'value' => ['name' => 'name']]); $this->assertInstanceOf(common_configuration_PHPDatabaseDriver::class, $output); - $output = $this->subject->buildFromArray(['type' => 'FileSystemComponent', 'value' => ['location' => '/path', 'rights' => 'rw']]); + $output = $this->subject->buildFromArray([ + 'type' => 'FileSystemComponent', + 'value' => [ + 'location' => '/path', + 'rights' => 'rw' + ] + ]); $this->assertInstanceOf(common_configuration_FileSystemComponent::class, $output); $output = $this->subject->buildFromArray(['type' => 'Mock', 'value' => ['status' => '/status']]); diff --git a/test/unit/common/configuration/FileSystemComponentTest.php b/test/unit/common/configuration/FileSystemComponentTest.php index 6cf17c999..df7e52802 100644 --- a/test/unit/common/configuration/FileSystemComponentTest.php +++ b/test/unit/common/configuration/FileSystemComponentTest.php @@ -125,7 +125,8 @@ public function testCheckDirectoryPermissionsSuccess() $this->assertEquals(common_configuration_Report::VALID, $output->getStatus()); $this->assertEquals( - "File system component 'tao.configuration.filesystem' in 'vfs://testDir7 is compliant with expected rights (rw).'", + "File system component 'tao.configuration.filesystem' in " + . "'vfs://testDir7 is compliant with expected rights (rw).'", $output->getMessage() ); } @@ -145,7 +146,8 @@ public function testCheckFilePermissionsSuccess() $this->assertEquals(common_configuration_Report::VALID, $output->getStatus()); $this->assertEquals( - "File system component 'tao.configuration.filesystem' in 'vfs://testDir8/test.txt is compliant with expected rights (rwx).'", + "File system component 'tao.configuration.filesystem' in " + . "'vfs://testDir8/test.txt is compliant with expected rights (rwx).'", $output->getMessage() ); } @@ -185,7 +187,8 @@ public function testCheckDirectoryContentSuccess() $this->assertEquals(common_configuration_Report::VALID, $output->getStatus()); $this->assertEquals( - "File system component 'tao.configuration.filesystem' in 'vfs://testDir10 is compliant with expected rights (rw).'", + "File system component 'tao.configuration.filesystem' in " + . "'vfs://testDir10 is compliant with expected rights (rw).'", $output->getMessage() ); } diff --git a/test/unit/common/persistence/AdvKeyValuePersistenceTest.php b/test/unit/common/persistence/AdvKeyValuePersistenceTest.php index 17cba5332..623af4750 100644 --- a/test/unit/common/persistence/AdvKeyValuePersistenceTest.php +++ b/test/unit/common/persistence/AdvKeyValuePersistenceTest.php @@ -245,9 +245,15 @@ public function testHDelSmallValue(): void $storedValue = $this->largeValuePersistence->hGet($key, $field); self::assertSame($value, $storedValue, 'The same value must be returned from persistence.'); - self::assertTrue($this->largeValuePersistence->hDel($key, $field), 'Method must return FALSE when value was deleted.'); + self::assertTrue( + $this->largeValuePersistence->hDel($key, $field), + 'Method must return FALSE when value was deleted.' + ); self::assertFalse($this->largeValuePersistence->hGet($key, $field), 'Value must be deleted from persistence.'); - self::assertFalse($this->largeValuePersistence->hDel($key, $field), 'Method must return FALSE when key/field does not exist.'); + self::assertFalse( + $this->largeValuePersistence->hDel($key, $field), + 'Method must return FALSE when key/field does not exist.' + ); } public function testHDelLargeValue(): void @@ -272,13 +278,22 @@ public function testHDelLargeValue(): void $keyMap = array_values($this->largeValuePersistence->get($key))[0]; $keyMap = json_decode(substr_replace($keyMap, '', 0, strlen($startMapDelimiter)), true); $mappedKye = $startMapDelimiter . $keyMap[0] . $endMapDelimiter; - self::assertFalse($this->largeValuePersistence->hDel($key, $mappedKye), 'It should not be allowed to delete one part of large value.'); + self::assertFalse( + $this->largeValuePersistence->hDel($key, $mappedKye), + 'It should not be allowed to delete one part of large value.' + ); $storedValue = $this->largeValuePersistence->hGet($key, $field); self::assertSame($value, $storedValue, 'The same value must be returned from persistence.'); - self::assertTrue($this->largeValuePersistence->hDel($key, $field), 'Method must return FALSE when value was deleted.'); + self::assertTrue( + $this->largeValuePersistence->hDel($key, $field), + 'Method must return FALSE when value was deleted.' + ); self::assertFalse($this->largeValuePersistence->hGet($key, $field), 'Value must be deleted from persistence.'); - self::assertFalse($this->largeValuePersistence->hDel($key, $field), 'Method must return FALSE when key/field does not exist.'); + self::assertFalse( + $this->largeValuePersistence->hDel($key, $field), + 'Method must return FALSE when key/field does not exist.' + ); } } diff --git a/test/unit/helpers/FileTest.php b/test/unit/helpers/FileTest.php index 731b1c70a..733a95558 100644 --- a/test/unit/helpers/FileTest.php +++ b/test/unit/helpers/FileTest.php @@ -51,13 +51,28 @@ public function testInDirectory() $this->assertFalse(\helpers_File::isFileInsideDirectory('test2.txt', $this->dir)); $this->assertTrue(\helpers_File::isFileInsideDirectory('test1.txt', $this->dir . DIRECTORY_SEPARATOR)); $this->assertFalse(\helpers_File::isFileInsideDirectory('sub' . DIRECTORY_SEPARATOR . 'test2.txt', $this->dir)); - $this->assertFalse(\helpers_File::isFileInsideDirectory('sub' . DIRECTORY_SEPARATOR . 'test2.txt', $this->dir . DIRECTORY_SEPARATOR)); + $this->assertFalse( + \helpers_File::isFileInsideDirectory( + 'sub' . DIRECTORY_SEPARATOR . 'test2.txt', + $this->dir . DIRECTORY_SEPARATOR + ) + ); $this->assertFalse(\helpers_File::isFileInsideDirectory('test1.txt', $this->subDir)); $this->assertFalse(\helpers_File::isFileInsideDirectory('test1.txt', $this->subDir . DIRECTORY_SEPARATOR)); $this->assertTrue(\helpers_File::isFileInsideDirectory('test2.txt', $this->subDir)); - $this->assertFalse(\helpers_File::isFileInsideDirectory('sub' . DIRECTORY_SEPARATOR . 'test2.txt', $this->subDir)); - $this->assertFalse(\helpers_File::isFileInsideDirectory('sub' . DIRECTORY_SEPARATOR . 'test2.txt', $this->subDir . DIRECTORY_SEPARATOR)); + $this->assertFalse( + \helpers_File::isFileInsideDirectory( + 'sub' . DIRECTORY_SEPARATOR . 'test2.txt', + $this->subDir + ) + ); + $this->assertFalse( + \helpers_File::isFileInsideDirectory( + 'sub' . DIRECTORY_SEPARATOR . 'test2.txt', + $this->subDir . DIRECTORY_SEPARATOR + ) + ); } protected function tearDown(): void diff --git a/test/unit/model/data/permission/FreeAccessTest.php b/test/unit/model/data/permission/FreeAccessTest.php index e3bd4826b..6ad621564 100644 --- a/test/unit/model/data/permission/FreeAccessTest.php +++ b/test/unit/model/data/permission/FreeAccessTest.php @@ -50,7 +50,10 @@ public function testGetPermissions() { $model = new FreeAccess(); $this->assertEquals(['res1' => [FreeAccess::RIGHT_UNSUPPORTED]], $model->getPermissions($this->user, ['res1'])); - $this->assertEquals(['res1' => [FreeAccess::RIGHT_UNSUPPORTED], 'res2' => [FreeAccess::RIGHT_UNSUPPORTED]], $model->getPermissions($this->user, ['res1', 'res2'])); + $this->assertEquals( + ['res1' => [FreeAccess::RIGHT_UNSUPPORTED], 'res2' => [FreeAccess::RIGHT_UNSUPPORTED]], + $model->getPermissions($this->user, ['res1', 'res2']) + ); } public function testGetSupportedRights() @@ -66,6 +69,9 @@ public function testPhpSerialize() $this->assertInstanceOf('oat\generis\model\data\permission\PermissionInterface', $restoredModel); $this->assertEquals([], $restoredModel->getSupportedRights()); - $this->assertEquals(['res1' => [FreeAccess::RIGHT_UNSUPPORTED]], $restoredModel->getPermissions($this->user, ['res1'])); + $this->assertEquals( + ['res1' => [FreeAccess::RIGHT_UNSUPPORTED]], + $restoredModel->getPermissions($this->user, ['res1']) + ); } } diff --git a/test/unit/model/data/permission/IntersectionTest.php b/test/unit/model/data/permission/IntersectionTest.php index 9087f8dec..29a2bf150 100644 --- a/test/unit/model/data/permission/IntersectionTest.php +++ b/test/unit/model/data/permission/IntersectionTest.php @@ -58,11 +58,21 @@ private function createIntersection() $permissionModel3->getPermissions($this->user, ['res1'])->willReturn(['res1' => ['rightC']]); // res2 - $permissionModel1->getPermissions($this->user, ['res1', 'res2'])->willReturn(['res1' => ['rightA', 'rightC'], 'res2' => []]); - $permissionModel2->getPermissions($this->user, ['res1', 'res2'])->willReturn(['res1' => ['rightC'], 'res2' => []]); - $permissionModel3->getPermissions($this->user, ['res1', 'res2'])->willReturn(['res1' => ['rightC', 'rightD'], 'res2' => []]); - - return Intersection::spawn([$permissionModel1->reveal(), $permissionModel2->reveal(), $permissionModel3->reveal()]); + $permissionModel1 + ->getPermissions($this->user, ['res1', 'res2']) + ->willReturn(['res1' => ['rightA', 'rightC'], 'res2' => []]); + $permissionModel2 + ->getPermissions($this->user, ['res1', 'res2']) + ->willReturn(['res1' => ['rightC'], 'res2' => []]); + $permissionModel3 + ->getPermissions($this->user, ['res1', 'res2']) + ->willReturn(['res1' => ['rightC', 'rightD'], 'res2' => []]); + + return Intersection::spawn([ + $permissionModel1->reveal(), + $permissionModel2->reveal(), + $permissionModel3->reveal() + ]); } public function testConstruct() @@ -74,7 +84,10 @@ public function testGetPermissions() { $model = $this->createIntersection(); $this->assertEquals(['res1' => []], $model->getPermissions($this->user, ['res1'])); - $this->assertEquals(['res1' => ['rightC'], 'res2' => []], $model->getPermissions($this->user, ['res1', 'res2'])); + $this->assertEquals( + ['res1' => ['rightC'], 'res2' => []], + $model->getPermissions($this->user, ['res1', 'res2']) + ); } public function testGetSupportedRights() diff --git a/test/unit/model/persistence/newsql/NewSqlRdfTest.php b/test/unit/model/persistence/newsql/NewSqlRdfTest.php index a46615baf..c68177781 100644 --- a/test/unit/model/persistence/newsql/NewSqlRdfTest.php +++ b/test/unit/model/persistence/newsql/NewSqlRdfTest.php @@ -33,7 +33,8 @@ class NewSqlRdfTest extends TestCase { public function testAdd() { - $query = 'INSERT INTO statements ( id, modelId, subject, predicate, object, l_language, epoch, author) VALUES ( ?, ? , ? , ? , ? , ? , ?, ?);'; + $query = 'INSERT INTO statements ( id, modelId, subject, predicate, object, l_language, epoch, author) VALUES ' + . '( ?, ? , ? , ? , ? , ? , ?, ?);'; $triple = new \core_kernel_classes_Triple(); $triple->modelid = 22; diff --git a/test/unit/model/persistence/smoothsql/SmoothRdfTest.php b/test/unit/model/persistence/smoothsql/SmoothRdfTest.php index d3ef30e5c..176cce6eb 100644 --- a/test/unit/model/persistence/smoothsql/SmoothRdfTest.php +++ b/test/unit/model/persistence/smoothsql/SmoothRdfTest.php @@ -77,7 +77,8 @@ public function testAdd() $persistence = $this->prophesize('\common_persistence_SqlPersistence'); $persistence->getPlatForm()->willReturn($platform->reveal()); - $query = "INSERT INTO statements ( modelId, subject, predicate, object, l_language, epoch, author) VALUES ( ? , ? , ? , ? , ? , ?, ?);"; + $query = "INSERT INTO statements ( modelId, subject, predicate, object, l_language, epoch, author) VALUES " + . "( ? , ? , ? , ? , ? , ?, ?);"; $triple = new \core_kernel_classes_Triple(); $triple->modelid = 22; @@ -118,7 +119,8 @@ public function testAddWithAuthor() $persistence = $this->prophesize('\common_persistence_SqlPersistence'); $persistence->getPlatForm()->willReturn($platform->reveal()); - $query = "INSERT INTO statements ( modelId, subject, predicate, object, l_language, epoch, author) VALUES ( ? , ? , ? , ? , ? , ?, ?);"; + $query = "INSERT INTO statements ( modelId, subject, predicate, object, l_language, epoch, author) VALUES " + . "( ? , ? , ? , ? , ? , ?, ?);"; $triple = new \core_kernel_classes_Triple(); $triple->modelid = 22; diff --git a/test/unit/oatbox/mutex/LockServiceTest.php b/test/unit/oatbox/mutex/LockServiceTest.php index 3f6d8be19..2fd79fb74 100644 --- a/test/unit/oatbox/mutex/LockServiceTest.php +++ b/test/unit/oatbox/mutex/LockServiceTest.php @@ -44,10 +44,26 @@ public function testLock() $sleep = 3; $this->getInstance(FlockStore::class, $dir); $time = time(); - $pipe1 = popen('php ' . __DIR__ . DIRECTORY_SEPARATOR . 'test_action.php ' . $actionId1 . ' ' . $sleep . ' FlockStore ' . $dir, 'w'); - $pipe2 = popen('php ' . __DIR__ . DIRECTORY_SEPARATOR . 'test_action.php ' . $actionId1 . ' ' . $sleep . ' FlockStore ' . $dir, 'w'); - $pipe3 = popen('php ' . __DIR__ . DIRECTORY_SEPARATOR . 'test_action.php ' . $actionId1 . ' ' . $sleep . ' FlockStore ' . $dir, 'w'); - $pipe4 = popen('php ' . __DIR__ . DIRECTORY_SEPARATOR . 'test_action.php ' . $actionId2 . ' ' . $sleep . ' FlockStore ' . $dir, 'w'); + $pipe1 = popen( + 'php ' . __DIR__ . DIRECTORY_SEPARATOR . 'test_action.php ' . $actionId1 . ' ' . $sleep + . ' FlockStore ' . $dir, + 'w' + ); + $pipe2 = popen( + 'php ' . __DIR__ . DIRECTORY_SEPARATOR . 'test_action.php ' . $actionId1 . ' ' . $sleep + . ' FlockStore ' . $dir, + 'w' + ); + $pipe3 = popen( + 'php ' . __DIR__ . DIRECTORY_SEPARATOR . 'test_action.php ' . $actionId1 . ' ' . $sleep + . ' FlockStore ' . $dir, + 'w' + ); + $pipe4 = popen( + 'php ' . __DIR__ . DIRECTORY_SEPARATOR . 'test_action.php ' . $actionId2 . ' ' . $sleep + . ' FlockStore ' . $dir, + 'w' + ); pclose($pipe1); pclose($pipe2); pclose($pipe3); @@ -63,9 +79,18 @@ public function testNoLock() $sleep = 3; $this->getInstance(NoLockStorage::class); $time = time(); - $pipe1 = popen('php ' . __DIR__ . DIRECTORY_SEPARATOR . 'test_action.php ' . $actionId1 . ' ' . $sleep . ' NoLockStorage', 'w'); - $pipe2 = popen('php ' . __DIR__ . DIRECTORY_SEPARATOR . 'test_action.php ' . $actionId1 . ' ' . $sleep . ' NoLockStorage', 'w'); - $pipe3 = popen('php ' . __DIR__ . DIRECTORY_SEPARATOR . 'test_action.php ' . $actionId1 . ' ' . $sleep . ' NoLockStorage', 'w'); + $pipe1 = popen( + 'php ' . __DIR__ . DIRECTORY_SEPARATOR . 'test_action.php ' . $actionId1 . ' ' . $sleep . ' NoLockStorage', + 'w' + ); + $pipe2 = popen( + 'php ' . __DIR__ . DIRECTORY_SEPARATOR . 'test_action.php ' . $actionId1 . ' ' . $sleep . ' NoLockStorage', + 'w' + ); + $pipe3 = popen( + 'php ' . __DIR__ . DIRECTORY_SEPARATOR . 'test_action.php ' . $actionId1 . ' ' . $sleep . ' NoLockStorage', + 'w' + ); pclose($pipe1); pclose($pipe2); pclose($pipe3); diff --git a/test/unit/oatbox/service/EnvironmentVariableTest.php b/test/unit/oatbox/service/EnvironmentVariableTest.php index 8719b42d5..c467571e3 100644 --- a/test/unit/oatbox/service/EnvironmentVariableTest.php +++ b/test/unit/oatbox/service/EnvironmentVariableTest.php @@ -55,7 +55,10 @@ public function testConstructorWithNonStringKeyThrowsException() public function testToPhpCode() { - $this->assertSame('new ' . EnvironmentVariable::class . '(' . Utils::toPHPVariableString(self::VAR_NAME) . ')', $this->subject->__toPhpCode()); + $this->assertSame( + 'new ' . EnvironmentVariable::class . '(' . Utils::toPHPVariableString(self::VAR_NAME) . ')', + $this->subject->__toPhpCode() + ); } public function testToString() From 700d6e04625cac22ae54a6e5e23b610b68fa6fec Mon Sep 17 00:00:00 2001 From: Andrei Shapiro Date: Tue, 30 May 2023 08:53:11 +0000 Subject: [PATCH 5/5] chore: apply PSR-12 manual changes --- common/cache/class.KeyValueCache.php | 5 +- common/cache/class.PartitionedCachable.php | 5 +- common/class.Collection.php | 6 +- common/class.Utils.php | 12 ++- .../class.ComponentCollection.php | 7 +- .../configuration/class.ComponentFactory.php | 16 +++- .../class.FileSystemComponent.php | 16 +++- common/configuration/class.Mock.php | 5 +- common/exception/class.ClientException.php | 3 +- .../exception/class.InvalidArgumentType.php | 3 +- common/exception/class.ResourceNotFound.php | 3 +- common/ext/class.Extension.php | 10 ++- common/ext/class.ExtensionHandler.php | 5 +- common/ext/class.ExtensionInstaller.php | 13 ++- common/ext/class.ExtensionModel.php | 8 +- common/ext/class.ExtensionUninstaller.php | 12 ++- common/ext/class.ExtensionUpdater.php | 5 +- common/ext/class.GenerisInstaller.php | 4 +- common/ext/class.UpdateExtensions.php | 13 ++- common/http/class.Request.php | 3 +- common/http/class.Response.php | 4 +- common/oatbox/Configurable.php | 4 +- common/oatbox/action/ActionService.php | 12 ++- common/oatbox/cache/KeyValueCache.php | 5 +- common/oatbox/extension/Manifest.php | 16 +++- .../extension/script/OptionContainer.php | 5 +- .../oatbox/extension/script/ScriptAction.php | 5 +- common/oatbox/filesystem/Directory.php | 13 ++- common/oatbox/filesystem/File.php | 12 ++- common/oatbox/install/Installer.php | 5 +- common/oatbox/log/ContainerLoggerTrait.php | 3 +- common/oatbox/log/LoggerAggregator.php | 4 +- common/oatbox/log/StreamHandler.php | 22 +++-- common/oatbox/log/logger/TaoLog.php | 13 ++- common/oatbox/log/logger/TaoMonolog.php | 28 ++++-- common/oatbox/service/ServiceConfigDriver.php | 3 +- common/oatbox/service/SimpleConfigDriver.php | 3 +- common/oatbox/task/AbstractTaskAction.php | 3 +- common/oatbox/task/Queue.php | 9 +- common/oatbox/task/RunTasks.php | 4 +- .../oatbox/task/TaskInterface/TaskPayLoad.php | 6 +- common/oatbox/task/TaskRunner.php | 8 +- .../InMemoryQueuePersistence.php | 3 +- .../oatbox/task/implementation/SyncQueue.php | 9 +- .../task/implementation/TaskQueuePayload.php | 10 ++- common/oatbox/user/UserLanguageService.php | 3 +- .../user/UserLanguageServiceInterface.php | 4 +- common/oatbox/user/auth/AuthFactory.php | 5 +- .../persistence/class.InMemoryAdvKvDriver.php | 3 +- .../persistence/class.KeyValuePersistence.php | 11 ++- common/persistence/class.PhpFileDriver.php | 80 ++++++++++++++++- common/persistence/class.SqlKvDriver.php | 26 ++++-- common/persistence/sql/SetupDb.php | 5 +- common/persistence/sql/class.Platform.php | 3 +- .../persistence/sql/class.UpdateMultiple.php | 3 +- common/report/class.Report.php | 20 ++++- .../php/class.KeyValueSessionHandler.php | 4 +- common/uri/class.MicrotimeUriProvider.php | 4 +- .../user/auth/class.AuthFailedException.php | 3 +- config/default/ontology.conf.php | 2 + helpers/class.ExtensionHelper.php | 9 +- helpers/class.File.php | 88 +++++++++++++++++-- helpers/class.InstallHelper.php | 3 +- helpers/class.RdfDiff.php | 13 ++- helpers/class.Report.php | 7 +- helpers/class.VersionedFile.php | 7 +- scripts/tools/CleanUpOrphanFiles.php | 21 ++++- .../tools/FileSerializerMigration/Migrate.php | 7 +- .../MigrationHelper.php | 7 +- scripts/update/Updater.php | 4 + 70 files changed, 574 insertions(+), 131 deletions(-) diff --git a/common/cache/class.KeyValueCache.php b/common/cache/class.KeyValueCache.php index b6181749c..f2d444216 100644 --- a/common/cache/class.KeyValueCache.php +++ b/common/cache/class.KeyValueCache.php @@ -47,7 +47,10 @@ class common_cache_KeyValueCache extends ConfigurableService implements common_c protected function getPersistence() { if (is_null($this->persistence)) { - $this->persistence = $this->getServiceLocator()->get('generis/persistences')->getPersistenceById($this->getOption(self::OPTION_PERSISTENCE)); + $this->persistence = $this + ->getServiceLocator() + ->get('generis/persistences') + ->getPersistenceById($this->getOption(self::OPTION_PERSISTENCE)); } return $this->persistence; } diff --git a/common/cache/class.PartitionedCachable.php b/common/cache/class.PartitionedCachable.php index 04f7e10f8..fca16552f 100644 --- a/common/cache/class.PartitionedCachable.php +++ b/common/cache/class.PartitionedCachable.php @@ -126,7 +126,10 @@ public function __sleep() } } if ($containsNonSerializable && $containsSerializable) { - throw new common_exception_Error('Serializable ' . $this->getSerial() . ' mixed serializable and non serializable values in property ' . $propertyName); + throw new common_exception_Error( + 'Serializable ' . $this->getSerial() + . ' mixed serializable and non serializable values in property ' . $propertyName + ); } } else { if (is_object($value) && $value instanceof self) { diff --git a/common/class.Collection.php b/common/class.Collection.php index e203e5d64..fd600803c 100644 --- a/common/class.Collection.php +++ b/common/class.Collection.php @@ -319,7 +319,11 @@ public function intersect(common_Collection $collection) $returnValue = new common_Collection(new common_Object(__METHOD__)); - $returnValue->sequence = array_uintersect($this->sequence, $collection->sequence, 'core_kernel_classes_ContainerComparator::compare'); + $returnValue->sequence = array_uintersect( + $this->sequence, + $collection->sequence, + 'core_kernel_classes_ContainerComparator::compare' + ); return $returnValue; diff --git a/common/class.Utils.php b/common/class.Utils.php index c790d3619..00f356cd4 100644 --- a/common/class.Utils.php +++ b/common/class.Utils.php @@ -64,7 +64,13 @@ public static function isUri($strarg) $returnValue = (bool) false; $uri = trim($strarg); if (!empty($uri)) { - if ((preg_match("/^(http|https|file|ftp):\/\/[\/:.A-Za-z0-9_-]+#[A-Za-z0-9_-]+$/", $uri) && strpos($uri, '#') > 0) || strpos($uri, "#") === 0) { + if ( + ( + preg_match("/^(http|https|file|ftp):\/\/[\/:.A-Za-z0-9_-]+#[A-Za-z0-9_-]+$/", $uri) + && strpos($uri, '#') > 0 + ) + || strpos($uri, "#") === 0 + ) { $returnValue = true; } } @@ -156,7 +162,9 @@ public static function toPHPVariableString($value) break; default: // resource and unexpected types - throw new common_exception_Error("Could not convert variable of type " . gettype($value) . " to PHP variable string"); + throw new common_exception_Error( + "Could not convert variable of type " . gettype($value) . " to PHP variable string" + ); } return (string) $returnValue; diff --git a/common/configuration/class.ComponentCollection.php b/common/configuration/class.ComponentCollection.php index 3da3754ce..0c8544cbb 100644 --- a/common/configuration/class.ComponentCollection.php +++ b/common/configuration/class.ComponentCollection.php @@ -211,7 +211,8 @@ public function check() array_push($traversed, $node); // mark the node as 'traversed'. if ($status == common_configuration_Report::VALID) { - $stack = self::pushTransitionsOnStack($stack, $this->getTransitions($node)); // put all transitions from the node to stack. + // put all transitions from the node to stack. + $stack = self::pushTransitionsOnStack($stack, $this->getTransitions($node)); while (count($stack) > 0) { $transition = array_pop($stack); @@ -232,7 +233,9 @@ public function check() $returnValue = $this->getReports(); } else { - throw new common_configuration_CyclicDependencyException("The dependency graph is cyclic. Please review your dependencies."); + throw new common_configuration_CyclicDependencyException( + "The dependency graph is cyclic. Please review your dependencies." + ); } } diff --git a/common/configuration/class.ComponentFactory.php b/common/configuration/class.ComponentFactory.php index 03383d4d8..63251c97b 100644 --- a/common/configuration/class.ComponentFactory.php +++ b/common/configuration/class.ComponentFactory.php @@ -254,7 +254,15 @@ public static function buildFromArray($array) if (!empty($array)) { if (!empty($array['type'])) { - $acceptedTypes = ['PHPRuntime', 'PHPINIValue', 'PHPExtension', 'PHPDatabaseDriver', 'FileSystemComponent', 'Custom', 'Mock']; + $acceptedTypes = [ + 'PHPRuntime', + 'PHPINIValue', + 'PHPExtension', + 'PHPDatabaseDriver', + 'FileSystemComponent', + 'Custom', + 'Mock' + ]; $cleanType = preg_replace('/^Check/i', '', $array['type']); if (in_array($cleanType, $acceptedTypes)) { if (!empty($array['value'])) { @@ -334,7 +342,11 @@ public static function buildFromArray($array) throw new common_configuration_ComponentFactoryException($msg); } - $returnValue = self::buildFileSystemComponent($values['location'], $values['rights'], $optional); + $returnValue = self::buildFileSystemComponent( + $values['location'], + $values['rights'], + $optional + ); break; case 'Custom': diff --git a/common/configuration/class.FileSystemComponent.php b/common/configuration/class.FileSystemComponent.php index 4f769476f..4dc94847e 100644 --- a/common/configuration/class.FileSystemComponent.php +++ b/common/configuration/class.FileSystemComponent.php @@ -84,8 +84,13 @@ class common_configuration_FileSystemComponent extends common_configuration_Comp * @throws common_configuration_MalformedRightsException * @return mixed */ - public function __construct($location, $expectedRights, $optional = false, $recursive = false, $mustCheckIfEmpty = false) - { + public function __construct( + $location, + $expectedRights, + $optional = false, + $recursive = false, + $mustCheckIfEmpty = false + ) { parent::__construct('tao.configuration.filesystem', $optional); $this->setExpectedRights($expectedRights); @@ -275,7 +280,8 @@ public function check() return new common_configuration_Report( common_configuration_Report::VALID, - "File system component '${name}' in '${location} is compliant with expected rights (${expectedRights}).'", + "File system component '${name}' in '${location} is compliant with expected rights " + . "(${expectedRights}).'", $this ); } @@ -304,7 +310,9 @@ private function hasLocationAccess($location = null, $rule = 'Readable') $funcName = 'is_' . strtolower($rule); $returnValue = $funcName($location); } else { - $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($location, \RecursiveDirectoryIterator::SKIP_DOTS)); + $iterator = new \RecursiveIteratorIterator( + new \RecursiveDirectoryIterator($location, \RecursiveDirectoryIterator::SKIP_DOTS) + ); try { $method = 'is' . $rule; diff --git a/common/configuration/class.Mock.php b/common/configuration/class.Mock.php index daca452f3..5bb95f26a 100644 --- a/common/configuration/class.Mock.php +++ b/common/configuration/class.Mock.php @@ -57,8 +57,9 @@ class common_configuration_Mock extends common_configuration_Component * * @access public * @author Jerome Bogaerts, - * @param int expectedStatus The expected status of the report that will be provided by the check method. Must correspond to a constant of the Report class. - * @param string name The name of the mock configuration component to make it identifiable among others. + * @param int $expectedStatus The expected status of the report that will be provided by the check method. Must + * correspond to a constant of the Report class. + * @param string $name The name of the mock configuration component to make it identifiable among others. * @return mixed */ public function __construct($expectedStatus, $name) diff --git a/common/exception/class.ClientException.php b/common/exception/class.ClientException.php index 63e3abc12..3e97b3443 100644 --- a/common/exception/class.ClientException.php +++ b/common/exception/class.ClientException.php @@ -24,7 +24,8 @@ * @package generis */ -abstract class common_exception_ClientException extends common_Exception implements common_exception_UserReadableException +abstract class common_exception_ClientException extends common_Exception implements + common_exception_UserReadableException { public function __construct($message = null, $code = 0) { diff --git a/common/exception/class.InvalidArgumentType.php b/common/exception/class.InvalidArgumentType.php index f6d21efc0..e3189080f 100644 --- a/common/exception/class.InvalidArgumentType.php +++ b/common/exception/class.InvalidArgumentType.php @@ -57,7 +57,8 @@ public function __construct($class = null, $function = 0, $position = 0, $expect { $object = is_object($object) ? get_class($object) : gettype($object); - $message = 'Argument ' . $position . ' passed to ' . $class . '::' . $function . '() must be an ' . $expectedType . ', ' . $object . ' given'; + $message = 'Argument ' . $position . ' passed to ' . $class . '::' . $function . '() must be an ' + . $expectedType . ', ' . $object . ' given'; parent::__construct($message); } } diff --git a/common/exception/class.ResourceNotFound.php b/common/exception/class.ResourceNotFound.php index 752abdc39..a65a86370 100644 --- a/common/exception/class.ResourceNotFound.php +++ b/common/exception/class.ResourceNotFound.php @@ -18,7 +18,8 @@ * Copyright (c) 2019 (original work) Open Assessment Technologies SA ; */ -class common_exception_ResourceNotFound extends \common_exception_NotFound implements \common_exception_UserReadableException +class common_exception_ResourceNotFound extends \common_exception_NotFound implements + \common_exception_UserReadableException { /** * @inheritdoc diff --git a/common/ext/class.Extension.php b/common/ext/class.Extension.php index 945d725da..0a06bf1ff 100755 --- a/common/ext/class.Extension.php +++ b/common/ext/class.Extension.php @@ -384,7 +384,10 @@ public function getManifest() if (is_file($manifestFile) && is_readable($manifestFile)) { $this->manifest = new Manifest($manifestFile); } else { - throw new ManifestNotFoundException("Extension Manifest not found for extension '" . $this->id . "'.", $this->id); + throw new ManifestNotFoundException( + "Extension Manifest not found for extension '" . $this->id . "'.", + $this->id + ); } } $this->manifest->setServiceLocator($this->getServiceLocator()); @@ -418,7 +421,10 @@ public function load() $this->getExtensionManager()->getExtensionById($extId); } } catch (ManifestNotFoundException $e) { - throw new common_ext_MissingExtensionException($e->getExtensionId() . ' not found but required for ' . $this->getId(), $e->getExtensionId()); + throw new common_ext_MissingExtensionException( + $e->getExtensionId() . ' not found but required for ' . $this->getId(), + $e->getExtensionId() + ); } $loader = new common_ext_ExtensionLoader($this); diff --git a/common/ext/class.ExtensionHandler.php b/common/ext/class.ExtensionHandler.php index 5e8f6735d..9803a671c 100644 --- a/common/ext/class.ExtensionHandler.php +++ b/common/ext/class.ExtensionHandler.php @@ -75,7 +75,10 @@ protected function getExtension() */ protected function runExtensionScript($script, array $arguments = []) { - $this->log('d', 'Running custom extension script ' . $script . ' for extension ' . $this->getExtension()->getId()); + $this->log( + 'd', + 'Running custom extension script ' . $script . ' for extension ' . $this->getExtension()->getId() + ); if (file_exists($script)) { require_once $script; } elseif (class_exists($script) && is_subclass_of($script, \oat\oatbox\action\Action::class)) { diff --git a/common/ext/class.ExtensionInstaller.php b/common/ext/class.ExtensionInstaller.php index 1fc21cba1..ccad6dac4 100755 --- a/common/ext/class.ExtensionInstaller.php +++ b/common/ext/class.ExtensionInstaller.php @@ -195,10 +195,19 @@ protected function installCustomScript() foreach ($this->extension->getManifest()->getInstallPHPFiles() as $script) { if (is_string($script)) { $this->runExtensionScript($script); - } elseif (is_array($script) && isset($script[0]) && is_string($script[0]) && !empty($script[0]) && isset($script[1]) && is_array($script[1])) { + } elseif ( + is_array($script) + && isset($script[0]) + && is_string($script[0]) + && !empty($script[0]) + && isset($script[1]) + && is_array($script[1]) + ) { $this->runExtensionScript($script[0], $script[1]); } else { - \common_Logger::w("Ignored custom install script because it's call definition is malformed in extension manifest!"); + \common_Logger::w( + "Ignored custom install script because it's call definition is malformed in extension manifest!" + ); } } } diff --git a/common/ext/class.ExtensionModel.php b/common/ext/class.ExtensionModel.php index d0ed1f902..fb8ff7961 100644 --- a/common/ext/class.ExtensionModel.php +++ b/common/ext/class.ExtensionModel.php @@ -40,11 +40,15 @@ public function addModelFiles($extension) { foreach ($extension->getManifest()->getInstallModelFiles() as $rdfpath) { if (!file_exists($rdfpath)) { - throw new common_ext_InstallationException("Unable to load ontology in '${rdfpath}' because the file does not exist."); + throw new common_ext_InstallationException( + "Unable to load ontology in '${rdfpath}' because the file does not exist." + ); } if (!is_readable($rdfpath)) { - throw new common_ext_InstallationException("Unable to load ontology in '${rdfpath}' because the file is not readable."); + throw new common_ext_InstallationException( + "Unable to load ontology in '${rdfpath}' because the file is not readable." + ); } $iterator = new FileIterator($rdfpath); diff --git a/common/ext/class.ExtensionUninstaller.php b/common/ext/class.ExtensionUninstaller.php index bfb53ebd7..f086390ee 100755 --- a/common/ext/class.ExtensionUninstaller.php +++ b/common/ext/class.ExtensionUninstaller.php @@ -49,17 +49,23 @@ public function uninstall() // uninstall possible if (is_null($this->extension->getManifest()->getUninstallData())) { - throw new common_Exception('Problem uninstalling extension ' . $this->extension->getId() . ' : Uninstall not supported'); + throw new common_Exception( + 'Problem uninstalling extension ' . $this->extension->getId() . ' : Uninstall not supported' + ); } // installed? if (!common_ext_ExtensionsManager::singleton()->isInstalled($this->extension->getId())) { - throw new common_Exception('Problem uninstalling extension ' . $this->extension->getId() . ' : Not installed'); + throw new common_Exception( + 'Problem uninstalling extension ' . $this->extension->getId() . ' : Not installed' + ); } // check dependcies if (helpers_ExtensionHelper::isRequired($this->extension)) { - throw new common_Exception('Problem uninstalling extension ' . $this->extension->getId() . ' : Still required'); + throw new common_Exception( + 'Problem uninstalling extension ' . $this->extension->getId() . ' : Still required' + ); }; common_Logger::d('uninstall script for ' . $this->extension->getId()); diff --git a/common/ext/class.ExtensionUpdater.php b/common/ext/class.ExtensionUpdater.php index f723f30d2..44aa8306f 100644 --- a/common/ext/class.ExtensionUpdater.php +++ b/common/ext/class.ExtensionUpdater.php @@ -149,7 +149,10 @@ public function safeLoadService($configId) } else { $namespace = substr($class_name, 0, $split); $class = substr($class_name, $split + 1); - eval('namespace ' . $namespace . '; ' . 'class ' . $class . ' extends \\oat\\oatbox\\service\\ConfigurableService {}'); + eval( + 'namespace ' . $namespace . '; ' . 'class ' . $class + . ' extends \\oat\\oatbox\\service\\ConfigurableService {}' + ); } }; $serviceManager = $this->getServiceManager(); diff --git a/common/ext/class.GenerisInstaller.php b/common/ext/class.GenerisInstaller.php index 62354afbc..201c6a442 100644 --- a/common/ext/class.GenerisInstaller.php +++ b/common/ext/class.GenerisInstaller.php @@ -49,7 +49,9 @@ class common_ext_GenerisInstaller extends common_ext_ExtensionInstaller public function install() { if ($this->extension->getId() != 'generis') { - throw new common_ext_ExtensionException('Tried to install "' . $this->extension->getId() . '" extension using the GenerisInstaller'); + throw new common_ext_ExtensionException( + 'Tried to install "' . $this->extension->getId() . '" extension using the GenerisInstaller' + ); } $this->installLoadDefaultConfig(); diff --git a/common/ext/class.UpdateExtensions.php b/common/ext/class.UpdateExtensions.php index bd87692b5..fdfee1ade 100644 --- a/common/ext/class.UpdateExtensions.php +++ b/common/ext/class.UpdateExtensions.php @@ -72,7 +72,9 @@ public function __invoke($params) $report->add(new Report(Report::TYPE_ERROR, $ex->getMessage())); break; } catch (Exception $e) { - $this->logError('Exception during update of ' . $ext->getId() . ': ' . get_class($e) . ' "' . $e->getMessage() . '"'); + $this->logError( + 'Exception during update of ' . $ext->getId() . ': ' . get_class($e) . ' "' . $e->getMessage() . '"' + ); $report->setType(Report::TYPE_ERROR); $report->setMessage('Update failed'); $report->add(new Report(Report::TYPE_ERROR, 'Exception during update of ' . $ext->getId() . '.')); @@ -99,7 +101,10 @@ protected function updateExtension(common_ext_Extension $ext) $installed = $this->getExtensionManager()->getInstalledVersion($ext->getId()); $codeVersion = $ext->getVersion(); if ($installed !== $codeVersion) { - $report = new Report(Report::TYPE_INFO, $ext->getName() . ' requires update from ' . $installed . ' to ' . $codeVersion); + $report = new Report( + Report::TYPE_INFO, + $ext->getName() . ' requires update from ' . $installed . ' to ' . $codeVersion + ); try { $updater = $ext->getUpdater(); $returnedVersion = $updater->update($installed); @@ -147,7 +152,9 @@ protected function updateExtension(common_ext_Extension $ext) protected function getMissingExtensions() { - $missingId = \helpers_ExtensionHelper::getMissingExtensionIds($this->getExtensionManager()->getInstalledExtensions()); + $missingId = \helpers_ExtensionHelper::getMissingExtensionIds( + $this->getExtensionManager()->getInstalledExtensions() + ); $missingExt = []; foreach ($missingId as $extId) { diff --git a/common/http/class.Request.php b/common/http/class.Request.php index 5ec4e0cee..aabe59081 100755 --- a/common/http/class.Request.php +++ b/common/http/class.Request.php @@ -39,7 +39,8 @@ class common_http_Request * The scheme in used (http|https) will be derived from * * * $_SERVER['HTTPS'] in case of a standard deployment - * * $_SERVER['HTTP_X_FORWARDED_PROTO'] or $_SERVER['HTTP_X_FORWARDED_SSL'] in case of being deployed behing a load balancer/proxy. + * * $_SERVER['HTTP_X_FORWARDED_PROTO'] or $_SERVER['HTTP_X_FORWARDED_SSL'] in case of being deployed behing a load + * balancer/proxy. * * If no clues about whether HTTPS is in use are found, HTTP will be the scheme of the current request. * diff --git a/common/http/class.Response.php b/common/http/class.Response.php index fb670c8d4..cd51dec3b 100755 --- a/common/http/class.Response.php +++ b/common/http/class.Response.php @@ -30,7 +30,9 @@ class common_http_Response { public $httpCode; - public $headerOut; //CURLINFO_HEADER_OUT The request string sent. For this to work, add the CURLINFO_HEADER_OUT option to the handle by calling curl_setopt() + // CURLINFO_HEADER_OUT The request string sent. For this to work, add the CURLINFO_HEADER_OUT option to the handle + // by calling curl_setopt() + public $headerOut; public $effectiveUrl; // Last effective URL public $responseData; } diff --git a/common/oatbox/Configurable.php b/common/oatbox/Configurable.php index 6107a365f..036af79f8 100644 --- a/common/oatbox/Configurable.php +++ b/common/oatbox/Configurable.php @@ -72,7 +72,9 @@ public function setOptions(array $options) if (is_object($options) && method_exists($options, 'toArray')) { $options = $options->toArray(); } else { - throw new \common_exception_Error('Options submitted to ' . get_called_class() . ' must be an array or implement toArray'); + throw new \common_exception_Error( + 'Options submitted to ' . get_called_class() . ' must be an array or implement toArray' + ); } } $this->options = $options; diff --git a/common/oatbox/action/ActionService.php b/common/oatbox/action/ActionService.php index a2974480d..c4bb0797b 100644 --- a/common/oatbox/action/ActionService.php +++ b/common/oatbox/action/ActionService.php @@ -29,7 +29,10 @@ class ActionService extends ConfigurableService { public const SERVICE_ID = 'generis/actionService'; - public static $blackList = ['\\oatbox\\composer\\ExtensionInstaller','\\oatbox\\composer\\ExtensionInstallerPlugin']; + public static $blackList = [ + '\\oatbox\\composer\\ExtensionInstaller', + '\\oatbox\\composer\\ExtensionInstallerPlugin' + ]; /** * @@ -55,7 +58,12 @@ public function getAvailableActions() $actions = $this->getCache()->get(__FUNCTION__); if (is_null($actions)) { $actions = []; - foreach ($this->getServiceLocator()->get(common_ext_ExtensionsManager::SERVICE_ID)->getInstalledExtensions() as $ext) { + $installedExtensions = $this + ->getServiceLocator() + ->get(common_ext_ExtensionsManager::SERVICE_ID) + ->getInstalledExtensions(); + + foreach ($installedExtensions as $ext) { $actions = array_merge($actions, $this->getActionsInDirectory($ext->getDir())); } $actions = array_merge($actions, $this->getActionsInDirectory(VENDOR_PATH . 'oat-sa')); diff --git a/common/oatbox/cache/KeyValueCache.php b/common/oatbox/cache/KeyValueCache.php index 666597fda..b7adf2245 100644 --- a/common/oatbox/cache/KeyValueCache.php +++ b/common/oatbox/cache/KeyValueCache.php @@ -93,7 +93,10 @@ protected function dateIntervalToSeconds(DateInterval $dateInterval): int protected function getPersistence() { if (is_null($this->persistence)) { - $this->persistence = $this->getServiceLocator()->get(PersistenceManager::SERVICE_ID)->getPersistenceById($this->getOption(self::OPTION_PERSISTENCE)); + $this->persistence = $this + ->getServiceLocator() + ->get(PersistenceManager::SERVICE_ID) + ->getPersistenceById($this->getOption(self::OPTION_PERSISTENCE)); } return $this->persistence; } diff --git a/common/oatbox/extension/Manifest.php b/common/oatbox/extension/Manifest.php index ac303e89d..aafdd1b8b 100644 --- a/common/oatbox/extension/Manifest.php +++ b/common/oatbox/extension/Manifest.php @@ -82,12 +82,16 @@ public function __construct($filePath, ComposerInfo $composerInfo = null) { // the file exists, we can refer to the $filePath. if (!is_readable($filePath)) { - throw new ManifestNotFoundException("The Extension Manifest file located at '${filePath}' could not be read."); + throw new ManifestNotFoundException( + "The Extension Manifest file located at '${filePath}' could not be read." + ); } $this->manifest = require($filePath); // mandatory if (empty($this->manifest['name'])) { - throw new exception\MalformedManifestException("The 'name' component is mandatory in manifest located at '{$this->filePath}'."); + throw new exception\MalformedManifestException( + "The 'name' component is mandatory in manifest located at '{$this->filePath}'." + ); } $this->composerInfo = $composerInfo; $this->filePath = $filePath; @@ -198,7 +202,9 @@ public function getInstallPHPFiles(): array { $result = []; if (isset($this->manifest['install']['php'])) { - $result = is_array($this->manifest['install']['php']) ? $this->manifest['install']['php'] : [$this->manifest['install']['php']]; + $result = is_array($this->manifest['install']['php']) + ? $this->manifest['install']['php'] + : [$this->manifest['install']['php']]; } return $result; } @@ -306,7 +312,9 @@ public static function extractChecks(string $file) { // the file exists, we can refer to the $filePath. if (!is_readable($file)) { - throw new ManifestNotFoundException(sprintf('The Extension Manifest file located at %s could not be read.', $file)); + throw new ManifestNotFoundException( + sprintf('The Extension Manifest file located at %s could not be read.', $file) + ); } $manifest = require($file); diff --git a/common/oatbox/extension/script/OptionContainer.php b/common/oatbox/extension/script/OptionContainer.php index e4d4fa873..d13c3e689 100644 --- a/common/oatbox/extension/script/OptionContainer.php +++ b/common/oatbox/extension/script/OptionContainer.php @@ -137,7 +137,10 @@ private static function extract(array $options, array $values) } else { // Edge case. Option found, but it is the last value of the $value array. if ($required) { - throw new MissingOptionException("No value given for required argument '${optionName}'.", $optionName); + throw new MissingOptionException( + "No value given for required argument '${optionName}'.", + $optionName + ); } elseif (isset($optionParams['defaultValue'])) { $returnValue[$optionName] = self::cast($optionParams['defaultValue'], $castTo); } diff --git a/common/oatbox/extension/script/ScriptAction.php b/common/oatbox/extension/script/ScriptAction.php index afca61a69..5c2721626 100644 --- a/common/oatbox/extension/script/ScriptAction.php +++ b/common/oatbox/extension/script/ScriptAction.php @@ -126,7 +126,10 @@ private function displayUsage(array $params) if (!empty($usageDescription) && is_array($usageDescription)) { if (!empty($usageDescription['prefix']) && in_array('-' . $usageDescription['prefix'], $params)) { return true; - } elseif (!empty($usageDescription['longPrefix']) && in_array('--' . $usageDescription['longPrefix'], $params)) { + } elseif ( + !empty($usageDescription['longPrefix']) + && in_array('--' . $usageDescription['longPrefix'], $params) + ) { return true; } } diff --git a/common/oatbox/filesystem/Directory.php b/common/oatbox/filesystem/Directory.php index 1b836afff..be239d313 100644 --- a/common/oatbox/filesystem/Directory.php +++ b/common/oatbox/filesystem/Directory.php @@ -186,15 +186,22 @@ public function rename($path) foreach ($filePaths as $renaming) { try { if ($this->getFileSystem()->rename($renaming['source'], $renaming['destination']) === false) { - throw new \common_exception_FileSystemError("Unable to rename '" . $renaming['source'] . "' into '" . $renaming['destination'] . "'."); + throw new \common_exception_FileSystemError( + "Unable to rename '" . $renaming['source'] . "' into '" . $renaming['destination'] . "'." + ); } } catch (FileExistsException $e) { - throw new \common_exception_FileSystemError("Unable to rename '" . $renaming['source'] . "' into '" . $renaming['destination'] . "'. File already exists."); + throw new \common_exception_FileSystemError( + "Unable to rename '" . $renaming['source'] . "' into '" . $renaming['destination'] + . "'. File already exists." + ); } } if (!$this->deleteSelf()) { - throw new \common_exception_FileSystemError("Could not finalize renaming of '" . $this->getPrefix() . "' into '${path}'."); + throw new \common_exception_FileSystemError( + "Could not finalize renaming of '" . $this->getPrefix() . "' into '${path}'." + ); } return true; diff --git a/common/oatbox/filesystem/File.php b/common/oatbox/filesystem/File.php index 1503bf64c..7ccdba8fc 100644 --- a/common/oatbox/filesystem/File.php +++ b/common/oatbox/filesystem/File.php @@ -121,7 +121,9 @@ public function write($mixed, $mimeType = null) $resource = StreamWrapper::getResource($mixed); if (!is_resource($resource)) { - throw new \common_Exception('Unable to create resource from the given stream. Write to filesystem aborted.'); + throw new \common_Exception( + 'Unable to create resource from the given stream. Write to filesystem aborted.' + ); } return $this->getFileSystem()->writeStream($this->getPrefix(), $resource, $config); } else { @@ -169,7 +171,9 @@ public function update($mixed, $mimeType = null) $resource = StreamWrapper::getResource($mixed); if (!is_resource($resource)) { - throw new \common_Exception('Unable to create resource from the given stream. Write to filesystem aborted.'); + throw new \common_Exception( + 'Unable to create resource from the given stream. Write to filesystem aborted.' + ); } return $this->getFileSystem()->updateStream($this->getPrefix(), $resource, $config); } @@ -211,7 +215,9 @@ public function put($mixed, $mimeType = null) $resource = StreamWrapper::getResource($mixed); if (!is_resource($resource)) { - throw new \common_Exception('Unable to create resource from the given stream. Write to filesystem aborted.'); + throw new \common_Exception( + 'Unable to create resource from the given stream. Write to filesystem aborted.' + ); } return $this->getFileSystem()->putStream($this->getPrefix(), $resource, $config); } diff --git a/common/oatbox/install/Installer.php b/common/oatbox/install/Installer.php index ff712b964..82767f475 100755 --- a/common/oatbox/install/Installer.php +++ b/common/oatbox/install/Installer.php @@ -115,7 +115,10 @@ protected function installFilesystem() public function setupExtensionManager(): void { - $this->getServiceManager()->register(\common_ext_ExtensionsManager::SERVICE_ID, new \common_ext_ExtensionsManager()); + $this->getServiceManager()->register( + \common_ext_ExtensionsManager::SERVICE_ID, + new \common_ext_ExtensionsManager() + ); } /** diff --git a/common/oatbox/log/ContainerLoggerTrait.php b/common/oatbox/log/ContainerLoggerTrait.php index 88f374f17..7352e7ebe 100644 --- a/common/oatbox/log/ContainerLoggerTrait.php +++ b/common/oatbox/log/ContainerLoggerTrait.php @@ -48,7 +48,8 @@ public function initContainer($container, $key = '') $this->getContainer()->offsetGet(LoggerService::SERVICE_ID)->getLogger() ); - // @TODO: implemented because of the legacy, we will don't need it when we're using the container in every case. + // @TODO: implemented because of the legacy, we will don't need it when we're using the container in every + // case. if (!empty($key)) { try { return $this->getContainer()->offsetGet($key); diff --git a/common/oatbox/log/LoggerAggregator.php b/common/oatbox/log/LoggerAggregator.php index 1a6fa7fbc..1b076d1b9 100644 --- a/common/oatbox/log/LoggerAggregator.php +++ b/common/oatbox/log/LoggerAggregator.php @@ -53,7 +53,9 @@ public function __construct($options = []) foreach ($this->getOptions() as $logger) { if (!$logger instanceof LoggerInterface) { - throw new \common_Exception('Non PSR-3 compatible logger ' . get_class($logger) . ' added to ' . __CLASS__); + throw new \common_Exception( + 'Non PSR-3 compatible logger ' . get_class($logger) . ' added to ' . __CLASS__ + ); } } diff --git a/common/oatbox/log/StreamHandler.php b/common/oatbox/log/StreamHandler.php index db1fcd2a8..623ce3814 100644 --- a/common/oatbox/log/StreamHandler.php +++ b/common/oatbox/log/StreamHandler.php @@ -50,8 +50,10 @@ class StreamHandler extends MonologStreamHandler public const PARAM_LOG_LEVEL = '--log-level'; /** - * @param resource|string $defaultStream (Unless this parameter is specified on the command line as --log-file, otherwise it is ignored) resource where data will be output - * @param int $defaultLevel (Unless this parameter is specified on the command line as --log-level, otherwise it is ignored) The minimum logging level at which this handler will be triggered + * @param resource|string $defaultStream (Unless this parameter is specified on the command line as --log-file, + * otherwise it is ignored) resource where data will be output + * @param int $defaultLevel (Unless this parameter is specified on the command line as --log-level, otherwise it is + * ignored) The minimum logging level at which this handler will be triggered * @param bool $bubble Whether the messages that are handled can bubble up the stack or not * @param int|null $filePermission Optional file permissions (default (0644) are only for owner read/write) * @param bool $useLocking Try to lock log file before doing any writes @@ -59,8 +61,13 @@ class StreamHandler extends MonologStreamHandler * @throws \Exception If a missing directory is not buildable * @throws \InvalidArgumentException If stream is not a resource or string */ - public function __construct($defaultStream, int $defaultLevel = Logger::DEBUG, bool $bubble = true, $filePermission = null, bool $useLocking = false) - { + public function __construct( + $defaultStream, + int $defaultLevel = Logger::DEBUG, + bool $bubble = true, + $filePermission = null, + bool $useLocking = false + ) { $stream = $this->getScriptParameter(self::PARAM_LOG_FILE) ?: $defaultStream; $logLevel = $this->getLogLevelParameter() ?: $defaultLevel; parent::__construct($stream, $logLevel, $bubble, $filePermission, $useLocking); @@ -92,7 +99,12 @@ private function getLogLevelParameter(): ?int $errorLevels = Logger::getLevels(); if (!isset($errorLevels[$logLevelParameter])) { - throw new \Exception(sprintf('Such log level doesn`t exist. Please, use one of: %s', implode(', ', array_flip($errorLevels)))); + throw new \Exception( + sprintf( + 'Such log level doesn`t exist. Please, use one of: %s', + implode(', ', array_flip($errorLevels)) + ) + ); } return $errorLevels[$logLevelParameter]; diff --git a/common/oatbox/log/logger/TaoLog.php b/common/oatbox/log/logger/TaoLog.php index f36108d8b..0eec2feb8 100644 --- a/common/oatbox/log/logger/TaoLog.php +++ b/common/oatbox/log/logger/TaoLog.php @@ -95,7 +95,18 @@ public function log($level, $message, array $context = []) $message = (string) $message; } $level = \common_log_Logger2Psr::getCommonFromPsrLevel($level); - $this->getDispatcher()->log(new \common_log_Item($message, $level, time(), $stack, $context, $requestURI, $errorFile, $errorLine)); + $this->getDispatcher()->log( + new \common_log_Item( + $message, + $level, + time(), + $stack, + $context, + $requestURI, + $errorFile, + $errorLine + ) + ); } /** diff --git a/common/oatbox/log/logger/TaoMonolog.php b/common/oatbox/log/logger/TaoMonolog.php index a35640a59..fd0ea2428 100644 --- a/common/oatbox/log/logger/TaoMonolog.php +++ b/common/oatbox/log/logger/TaoMonolog.php @@ -78,7 +78,9 @@ protected function buildLogger() if ($this->hasOption('processors')) { $processorsOptions = $this->getOption('processors'); if (!is_array($processorsOptions)) { - throw new \common_configuration_ComponentFactoryException('Handler processors options as to be formatted as array'); + throw new \common_configuration_ComponentFactoryException( + 'Handler processors options as to be formatted as array' + ); } foreach ($processorsOptions as $processorsOption) { @@ -97,11 +99,15 @@ protected function buildLogger() protected function buildHandler(array $options) { if (!isset($options['class'])) { - throw new \common_configuration_ComponentFactoryException('Handler options has to contain a class attribute.'); + throw new \common_configuration_ComponentFactoryException( + 'Handler options has to contain a class attribute.' + ); } if (!is_a($options['class'], HandlerInterface::class, true)) { - throw new \common_configuration_ComponentFactoryException('Handler class option has to be a HandlerInterface.'); + throw new \common_configuration_ComponentFactoryException( + 'Handler class option has to be a HandlerInterface.' + ); } $handlerOptions = []; @@ -114,7 +120,9 @@ protected function buildHandler(array $options) if (isset($options['processors'])) { $processorsOptions = $options['processors']; if (!is_array($processorsOptions)) { - throw new \common_configuration_ComponentFactoryException('Handler processors options as to be formatted as array'); + throw new \common_configuration_ComponentFactoryException( + 'Handler processors options as to be formatted as array' + ); } foreach ($processorsOptions as $processorsOption) { @@ -140,7 +148,9 @@ protected function buildProcessor($options) return $options; } else { if (!isset($options['class'])) { - throw new \common_configuration_ComponentFactoryException('Processor options has to contain a class attribute.'); + throw new \common_configuration_ComponentFactoryException( + 'Processor options has to contain a class attribute.' + ); } $processorOptions = []; @@ -166,11 +176,15 @@ protected function buildFormatter($options) return $options; } else { if (!isset($options['class'])) { - throw new \common_configuration_ComponentFactoryException('Formatter options has to contain a class attribute.'); + throw new \common_configuration_ComponentFactoryException( + 'Formatter options has to contain a class attribute.' + ); } if (!is_a($options['class'], FormatterInterface::class, true)) { - throw new \common_configuration_ComponentFactoryException('Formatter class option has to be a FormatterInterface.'); + throw new \common_configuration_ComponentFactoryException( + 'Formatter class option has to be a FormatterInterface.' + ); } $formatterOptions = []; diff --git a/common/oatbox/service/ServiceConfigDriver.php b/common/oatbox/service/ServiceConfigDriver.php index e21533ccf..255d65b15 100644 --- a/common/oatbox/service/ServiceConfigDriver.php +++ b/common/oatbox/service/ServiceConfigDriver.php @@ -46,7 +46,8 @@ protected function getContent($key, $value) if (! $value instanceof ConfigurableService) { return null; } - $content = $value->getHeader() . PHP_EOL . "return " . common_Utils::toHumanReadablePhpString($value) . ";" . PHP_EOL; + $content = $value->getHeader() . PHP_EOL . "return " . common_Utils::toHumanReadablePhpString($value) . ";" + . PHP_EOL; return $content; } diff --git a/common/oatbox/service/SimpleConfigDriver.php b/common/oatbox/service/SimpleConfigDriver.php index b0ab436b5..4adada39c 100644 --- a/common/oatbox/service/SimpleConfigDriver.php +++ b/common/oatbox/service/SimpleConfigDriver.php @@ -38,7 +38,8 @@ class SimpleConfigDriver extends common_persistence_PhpFileDriver implements Con */ protected function getContent($key, $value) { - return $this->getDefaultHeader($key) . PHP_EOL . "return " . common_Utils::toHumanReadablePhpString($value) . ";" . PHP_EOL; + return $this->getDefaultHeader($key) . PHP_EOL . "return " . common_Utils::toHumanReadablePhpString($value) + . ";" . PHP_EOL; } /** diff --git a/common/oatbox/task/AbstractTaskAction.php b/common/oatbox/task/AbstractTaskAction.php index 949db475c..4fd806792 100644 --- a/common/oatbox/task/AbstractTaskAction.php +++ b/common/oatbox/task/AbstractTaskAction.php @@ -30,7 +30,8 @@ * * @author Aleh Hutnikau * - * @deprecated since version 7.10.0, to be removed in 8.0. Use \oat\tao\model\taskQueue\Task\FilesystemAwareTrait instead. + * @deprecated since version 7.10.0, to be removed in 8.0. Use \oat\tao\model\taskQueue\Task\FilesystemAwareTrait + * instead. */ abstract class AbstractTaskAction extends AbstractAction { diff --git a/common/oatbox/task/Queue.php b/common/oatbox/task/Queue.php index a272669ae..4db5d3508 100644 --- a/common/oatbox/task/Queue.php +++ b/common/oatbox/task/Queue.php @@ -33,12 +33,14 @@ interface Queue extends \IteratorAggregate public const CONFIG_ID = 'generis/taskqueue'; /** - * @deprecated since version 7.10.0, to be removed in 8.0. Use \oat\tao\model\taskQueue\QueueDispatcherInterface::SERVICE_ID instead. + * @deprecated since version 7.10.0, to be removed in 8.0. Use + * \oat\tao\model\taskQueue\QueueDispatcherInterface::SERVICE_ID instead. */ public const SERVICE_ID = 'generis/taskqueue'; /** - * @deprecated since version 7.10.0, to be removed in 8.0. Use \oat\tao\model\taskQueue\QueueDispatcherInterface::FILE_SYSTEM_ID instead. + * @deprecated since version 7.10.0, to be removed in 8.0. Use + * \oat\tao\model\taskQueue\QueueDispatcherInterface::FILE_SYSTEM_ID instead. */ public const FILE_SYSTEM_ID = 'taskQueueStorage'; @@ -47,7 +49,8 @@ interface Queue extends \IteratorAggregate * @param $parameters * @param $label * @param $task - * @param boolean $repeatedly Whether task created repeatedly (for example when execution of task was failed and task puts to the queue again). + * @param boolean $repeatedly Whether task created repeatedly (for example when execution of task was failed and + * task puts to the queue again). * @return mixed * * @deprecated since version 7.10.0, to be removed in 8.0. diff --git a/common/oatbox/task/RunTasks.php b/common/oatbox/task/RunTasks.php index ac43b7a52..11dd12466 100644 --- a/common/oatbox/task/RunTasks.php +++ b/common/oatbox/task/RunTasks.php @@ -44,8 +44,8 @@ class RunTasks extends ConfigurableService implements Action protected $params = []; /** - * @param array $params - * $params[0] (int) tasks limit. If parameter is not given or equals 0 then all tasks in queue will be executed. + * @param array $params $params[0] (int) tasks limit. If parameter is not given or equals 0 then all tasks in queue + * will be executed. * @return \common_report_Report */ public function __invoke($params) diff --git a/common/oatbox/task/TaskInterface/TaskPayLoad.php b/common/oatbox/task/TaskInterface/TaskPayLoad.php index 7b9562112..5fe75b43e 100644 --- a/common/oatbox/task/TaskInterface/TaskPayLoad.php +++ b/common/oatbox/task/TaskInterface/TaskPayLoad.php @@ -30,7 +30,11 @@ */ interface TaskPayLoad extends DatatablePayload, ServiceLocatorAwareInterface { - public function __construct(TaskPersistenceInterface $persistence, $currentUserId = null, DatatableRequestInterface $request = null); + public function __construct( + TaskPersistenceInterface $persistence, + $currentUserId = null, + DatatableRequestInterface $request = null + ); /** * @deprecated since version 7.10.0, to be removed in 8.0. diff --git a/common/oatbox/task/TaskRunner.php b/common/oatbox/task/TaskRunner.php index bbf91b70c..fd3231933 100644 --- a/common/oatbox/task/TaskRunner.php +++ b/common/oatbox/task/TaskRunner.php @@ -29,7 +29,8 @@ use common_report_Report as Report; /** - * @deprecated since version 7.10.0, to be removed in 8.0. Use any implementation of \oat\tao\model\taskQueue\Worker\WorkerInterface instead. + * @deprecated since version 7.10.0, to be removed in 8.0. Use any implementation of + * \oat\tao\model\taskQueue\Worker\WorkerInterface instead. */ class TaskRunner implements TaskRunnerInterface { @@ -42,7 +43,10 @@ public function run(Task $task) { \common_Logger::d('Running task ' . $task->getId()); - $report = new Report(\common_report_Report::TYPE_INFO, __('Running task %s at %s', $task->getId(), microtime(true))); + $report = new Report( + \common_report_Report::TYPE_INFO, + __('Running task %s at %s', $task->getId(), microtime(true)) + ); /** @var TaskQueue $queue */ $queue = $this->getServiceLocator()->get(Queue::SERVICE_ID); $queue->updateTaskStatus($task->getId(), Task::STATUS_RUNNING); diff --git a/common/oatbox/task/implementation/InMemoryQueuePersistence.php b/common/oatbox/task/implementation/InMemoryQueuePersistence.php index 35d57fc6d..4104e01ec 100644 --- a/common/oatbox/task/implementation/InMemoryQueuePersistence.php +++ b/common/oatbox/task/implementation/InMemoryQueuePersistence.php @@ -26,7 +26,8 @@ use Zend\ServiceManager\ServiceLocatorAwareTrait; /** - * @deprecated since version 7.10.0, to be removed in 8.0. Use \oat\tao\model\taskQueue\Queue\Broker\InMemoryQueueBroker instead. + * @deprecated since version 7.10.0, to be removed in 8.0. Use \oat\tao\model\taskQueue\Queue\Broker\InMemoryQueueBroker + * instead. */ class InMemoryQueuePersistence implements TaskPersistenceInterface { diff --git a/common/oatbox/task/implementation/SyncQueue.php b/common/oatbox/task/implementation/SyncQueue.php index f8426b5d4..02873a34d 100644 --- a/common/oatbox/task/implementation/SyncQueue.php +++ b/common/oatbox/task/implementation/SyncQueue.php @@ -102,10 +102,15 @@ public function linkTask(Task $task, \core_kernel_classes_Resource $resource = n $taskResource = parent::linkTask($task, $resource); $report = $task->getReport(); if (!empty($report)) { - //serialize only two first report levels because sometimes serialized report is huge and it does not fit into `k_po` index of statemetns table. + // serialize only two first report levels because sometimes serialized report is huge and it does not fit + // into `k_po` index of statemetns table. $serializableReport = new Report($report->getType(), $report->getMessage(), $report->getData()); foreach ($report as $subReport) { - $serializableSubReport = new Report($subReport->getType(), $subReport->getMessage(), $subReport->getData()); + $serializableSubReport = new Report( + $subReport->getType(), + $subReport->getMessage(), + $subReport->getData() + ); $serializableReport->add($serializableSubReport); } $taskResource->setPropertyValue( diff --git a/common/oatbox/task/implementation/TaskQueuePayload.php b/common/oatbox/task/implementation/TaskQueuePayload.php index e2afb77a1..3b8fadf31 100644 --- a/common/oatbox/task/implementation/TaskQueuePayload.php +++ b/common/oatbox/task/implementation/TaskQueuePayload.php @@ -17,7 +17,8 @@ use Zend\ServiceManager\ServiceLocatorAwareTrait; /** - * @deprecated since version 7.10.0, to be removed in 8.0. Use \oat\tao\model\taskQueue\TaskLog\DataTablePayload instead. + * @deprecated since version 7.10.0, to be removed in 8.0. Use \oat\tao\model\taskQueue\TaskLog\DataTablePayload + * instead. */ class TaskQueuePayload implements TaskPayLoad { @@ -91,8 +92,11 @@ public function count() return $this->persistence->count($params); } - public function __construct(TaskPersistenceInterface $persistence, $currentUserId = null, DatatableRequestInterface $request = null) - { + public function __construct( + TaskPersistenceInterface $persistence, + $currentUserId = null, + DatatableRequestInterface $request = null + ) { $this->persistence = $persistence; $this->currentUserId = $currentUserId; diff --git a/common/oatbox/user/UserLanguageService.php b/common/oatbox/user/UserLanguageService.php index 5e2880a1b..7aa2e8d40 100644 --- a/common/oatbox/user/UserLanguageService.php +++ b/common/oatbox/user/UserLanguageService.php @@ -73,7 +73,8 @@ public function getInterfaceLanguage(User $user) */ public function isDataLanguageEnabled() { - return !$this->hasOption(self::OPTION_LOCK_DATA_LANGUAGE) || $this->getOption(self::OPTION_LOCK_DATA_LANGUAGE) === false; + return !$this->hasOption(self::OPTION_LOCK_DATA_LANGUAGE) + || $this->getOption(self::OPTION_LOCK_DATA_LANGUAGE) === false; } public function getAuthoringLanguage(): string diff --git a/common/oatbox/user/UserLanguageServiceInterface.php b/common/oatbox/user/UserLanguageServiceInterface.php index 35415376c..4f19b7fb2 100644 --- a/common/oatbox/user/UserLanguageServiceInterface.php +++ b/common/oatbox/user/UserLanguageServiceInterface.php @@ -53,8 +53,8 @@ public function getInterfaceLanguage(User $user); public function isDataLanguageEnabled(); /** - * When a custom interface language is set, it overrides the interface language retrieved in the getInterfaceLanguage - * method. + * When a custom interface language is set, it overrides the interface language retrieved in the + * getInterfaceLanguage method. * * @param ?string $customInterfaceLanguage */ diff --git a/common/oatbox/user/auth/AuthFactory.php b/common/oatbox/user/auth/AuthFactory.php index 76b899dc6..6417f9ed2 100755 --- a/common/oatbox/user/auth/AuthFactory.php +++ b/common/oatbox/user/auth/AuthFactory.php @@ -43,7 +43,10 @@ public static function createAdapters() if (isset($adapterConf['driver'])) { $className = $adapterConf['driver']; unset($adapterConf['driver']); - if (class_exists($className) && in_array(__NAMESPACE__ . '\LoginAdapter', class_implements($className))) { + if ( + class_exists($className) + && in_array(__NAMESPACE__ . '\LoginAdapter', class_implements($className)) + ) { $adapter = new $className(); $adapter->setOptions($adapterConf); $adapters[] = $adapter; diff --git a/common/persistence/class.InMemoryAdvKvDriver.php b/common/persistence/class.InMemoryAdvKvDriver.php index 04db3ef36..a934183f3 100644 --- a/common/persistence/class.InMemoryAdvKvDriver.php +++ b/common/persistence/class.InMemoryAdvKvDriver.php @@ -19,7 +19,8 @@ * */ -class common_persistence_InMemoryAdvKvDriver extends common_persistence_InMemoryKvDriver implements common_persistence_AdvKvDriver +class common_persistence_InMemoryAdvKvDriver extends common_persistence_InMemoryKvDriver implements + common_persistence_AdvKvDriver { public const HPREFIX = 'hPrfx_'; diff --git a/common/persistence/class.KeyValuePersistence.php b/common/persistence/class.KeyValuePersistence.php index 67a3c04ed..fac94e581 100755 --- a/common/persistence/class.KeyValuePersistence.php +++ b/common/persistence/class.KeyValuePersistence.php @@ -220,8 +220,15 @@ public function purge() * @return mixed * @throws common_Exception */ - protected function setLargeValue($key, $value, $level = 0, $flush = true, $toTransform = true, $ttl = null, $nx = false) - { + protected function setLargeValue( + $key, + $value, + $level = 0, + $flush = true, + $toTransform = true, + $ttl = null, + $nx = false + ) { if (!$this->isLarge($value)) { if ($flush) { $this->set($key, $value, $ttl, $nx); diff --git a/common/persistence/class.PhpFileDriver.php b/common/persistence/class.PhpFileDriver.php index ebf5364d6..a434e8887 100755 --- a/common/persistence/class.PhpFileDriver.php +++ b/common/persistence/class.PhpFileDriver.php @@ -44,7 +44,72 @@ class common_persistence_PhpFileDriver implements common_persistence_KvDriver, c * List of characters permited in filename * @var array */ - private static $ALLOWED_CHARACTERS = ['A' => '','B' => '','C' => '','D' => '','E' => '','F' => '','G' => '','H' => '','I' => '','J' => '','K' => '','L' => '','M' => '','N' => '','O' => '','P' => '','Q' => '','R' => '','S' => '','T' => '','U' => '','V' => '','W' => '','X' => '','Y' => '','Z' => '','a' => '','b' => '','c' => '','d' => '','e' => '','f' => '','g' => '','h' => '','i' => '','j' => '','k' => '','l' => '','m' => '','n' => '','o' => '','p' => '','q' => '','r' => '','s' => '','t' => '','u' => '','v' => '','w' => '','x' => '','y' => '','z' => '',0 => '',1 => '',2 => '',3 => '',4 => '',5 => '',6 => '',7 => '',8 => '',9 => '','_' => '','-' => '']; + private static $ALLOWED_CHARACTERS = [ + 'A' => '', + 'B' => '', + 'C' => '', + 'D' => '', + 'E' => '', + 'F' => '', + 'G' => '', + 'H' => '', + 'I' => '', + 'J' => '', + 'K' => '', + 'L' => '', + 'M' => '', + 'N' => '', + 'O' => '', + 'P' => '', + 'Q' => '', + 'R' => '', + 'S' => '', + 'T' => '', + 'U' => '', + 'V' => '', + 'W' => '', + 'X' => '', + 'Y' => '', + 'Z' => '', + 'a' => '', + 'b' => '', + 'c' => '', + 'd' => '', + 'e' => '', + 'f' => '', + 'g' => '', + 'h' => '', + 'i' => '', + 'j' => '', + 'k' => '', + 'l' => '', + 'm' => '', + 'n' => '', + 'o' => '', + 'p' => '', + 'q' => '', + 'r' => '', + 's' => '', + 't' => '', + 'u' => '', + 'v' => '', + 'w' => '', + 'x' => '', + 'y' => '', + 'z' => '', + 0 => '', + 1 => '', + 2 => '', + 3 => '', + 4 => '', + 5 => '', + 6 => '', + 7 => '', + 8 => '', + 9 => '', + '_' => '', + '-' => '', + ]; /** * absolute path of the directory to use @@ -92,7 +157,8 @@ class common_persistence_PhpFileDriver implements common_persistence_KvDriver, c public function connect($id, array $params) { $this->directory = isset($params['dir']) - ? $params['dir'] . ($params['dir'][strlen($params['dir']) - 1] === DIRECTORY_SEPARATOR ? '' : DIRECTORY_SEPARATOR) + ? $params['dir'] + . ($params['dir'][strlen($params['dir']) - 1] === DIRECTORY_SEPARATOR ? '' : DIRECTORY_SEPARATOR) : FILES_PATH . 'generis' . DIRECTORY_SEPARATOR . $id . DIRECTORY_SEPARATOR; $this->levels = isset($params['levels']) ? $params['levels'] : self::DEFAULT_LEVELS; $this->humanReadable = isset($params['humanReadable']) ? $params['humanReadable'] : false; @@ -207,7 +273,12 @@ private function makeDirectory(string $path, int $mode) if (is_dir($path)) { \common_Logger::w(sprintf('Directory already exists. Path: \'%s\'', $path)); } elseif (is_file($path)) { - \common_Logger::w(sprintf('Directory was not created. File with the same name already exists. Path: \'%s\'', $path)); + \common_Logger::w( + sprintf( + 'Directory was not created. File with the same name already exists. Path: \'%s\'', + $path + ) + ); } else { \common_Logger::w(sprintf('Directory was not created. Path: \'%s\'', $path)); } @@ -389,7 +460,8 @@ protected function getPath($key) $path = $this->sanitizeReadableFileName($key); } else { $encoded = hash('md5', $key); - $path = implode(DIRECTORY_SEPARATOR, str_split(substr($encoded, 0, $this->levels))) . DIRECTORY_SEPARATOR . $encoded; + $path = implode(DIRECTORY_SEPARATOR, str_split(substr($encoded, 0, $this->levels))) + . DIRECTORY_SEPARATOR . $encoded; } return $this->directory . $path . '.php'; } diff --git a/common/persistence/class.SqlKvDriver.php b/common/persistence/class.SqlKvDriver.php index 3479d1e20..7baa8cb36 100755 --- a/common/persistence/class.SqlKvDriver.php +++ b/common/persistence/class.SqlKvDriver.php @@ -64,7 +64,9 @@ public function connect($id, array $params) } $this->sqlPersistenceId = $params[self::OPTION_PERSISTENCE_SQL]; - $this->sqlPersistence = common_persistence_SqlPersistence::getPersistence($params[self::OPTION_PERSISTENCE_SQL]); + $this->sqlPersistence = common_persistence_SqlPersistence::getPersistence( + $params[self::OPTION_PERSISTENCE_SQL] + ); $this->garbageCollection = isset($params['gc']) ? $params['gc'] : self::DEFAULT_GC_PROBABILITY; @@ -107,12 +109,20 @@ public function set($id, $value, $ttl = null, $nx = false) WHEN MATHED THEN UPDATE SET kv_value = :data WHERE kv_id = :id"; } else { $statement = 'UPDATE kv_store SET kv_value = :data , kv_time = :time WHERE kv_id = :id'; - $returnValue = $this->sqlPersistence->exec($statement, $params, ['data' => ParameterType::STRING, 'time' => ParameterType::INTEGER, 'id' => ParameterType::STRING]); + $returnValue = $this->sqlPersistence->exec( + $statement, + $params, + ['data' => ParameterType::STRING, 'time' => ParameterType::INTEGER, 'id' => ParameterType::STRING] + ); if (0 === $returnValue) { $returnValue = $this->sqlPersistence->insert( 'kv_store', ['kv_id' => $id, 'kv_time' => $expire, 'kv_value' => $encoded], - ['kv_id' => ParameterType::STRING, 'kv_time' => ParameterType::INTEGER, 'kv_value' => ParameterType::STRING] + [ + 'kv_id' => ParameterType::STRING, + 'kv_time' => ParameterType::INTEGER, + 'kv_value' => ParameterType::STRING + ] ); } } @@ -121,7 +131,9 @@ public function set($id, $value, $ttl = null, $nx = false) $this->gc(); } } catch (Exception $e) { - throw new common_Exception("Unable to write the key value storage table in the database " . $e->getMessage()); + throw new common_Exception( + "Unable to write the key value storage table in the database " . $e->getMessage() + ); } return (bool)$returnValue; } @@ -202,7 +214,8 @@ public function incr($id) $statement = 'UPDATE kv_store SET kv_value = kv_value::integer + 1 WHERE kv_id = :id'; break; case 'gcp-spanner': - $statement = 'UPDATE kv_store SET kv_value = CAST(CAST(kv_value as INT64) + 1 as string) WHERE kv_id = :id'; + $statement = 'UPDATE kv_store SET kv_value = CAST(CAST(kv_value as INT64) + 1 as string) WHERE ' + . 'kv_id = :id'; break; default: $statement = 'UPDATE kv_store SET kv_value = kv_value + 1 WHERE kv_id = :id'; @@ -223,7 +236,8 @@ public function decr($id) $statement = 'UPDATE kv_store SET kv_value = kv_value::integer - 1 WHERE kv_id = :id'; break; case 'gcp-spanner': - $statement = 'UPDATE kv_store SET kv_value = CAST(CAST(kv_value as INT64) - 1 as string) WHERE kv_id = :id'; + $statement = 'UPDATE kv_store SET kv_value = CAST(CAST(kv_value as INT64) - 1 as string) WHERE ' + . 'kv_id = :id'; break; default: $statement = 'UPDATE kv_store SET kv_value = kv_value - 1 WHERE kv_id = :id'; diff --git a/common/persistence/sql/SetupDb.php b/common/persistence/sql/SetupDb.php index 72d8d38df..262e68d79 100644 --- a/common/persistence/sql/SetupDb.php +++ b/common/persistence/sql/SetupDb.php @@ -53,7 +53,10 @@ private function verifyDatabase(\common_persistence_SqlPersistence $p, $dbName) { $schemaManager = $p->getSchemaManager()->getDbalSchemaManager(); if (!$this->dbExists($schemaManager, $dbName)) { - throw new \tao_install_utils_Exception('Unable to find the database, make sure that the db exists and that the db user has the rights to use it.'); + throw new \tao_install_utils_Exception( + 'Unable to find the database, make sure that the db exists and that the db user has the rights ' + . 'to use it.' + ); } } diff --git a/common/persistence/sql/class.Platform.php b/common/persistence/sql/class.Platform.php index aeb1068b1..d9581903c 100644 --- a/common/persistence/sql/class.Platform.php +++ b/common/persistence/sql/class.Platform.php @@ -338,7 +338,8 @@ public function rollBack() * Commits the current transaction. * * @return void - * @throws \Doctrine\DBAL\ConnectionException If the commit failed due to no active transaction or because the transaction was marked for rollback only. + * @throws \Doctrine\DBAL\ConnectionException If the commit failed due to no active transaction or because the + * transaction was marked for rollback only. * @throws DBALException * @throws common_persistence_sql_SerializationException In case of SerializationFailure (SQLSTATE 40001). */ diff --git a/common/persistence/sql/class.UpdateMultiple.php b/common/persistence/sql/class.UpdateMultiple.php index 3237ec0d6..ac72b908c 100644 --- a/common/persistence/sql/class.UpdateMultiple.php +++ b/common/persistence/sql/class.UpdateMultiple.php @@ -119,7 +119,8 @@ public function buildQuery($table, array $data) $conditionColumn = $condition['conditionColumn']; $conditionValue = $condition['conditionValue']; - $key = ':' . $index . '_' . $column . '_' . $indexCondition . '_' . $conditionColumn . '_conditionvalue'; + $key = ':' . $index . '_' . $column . '_' . $indexCondition . '_' . $conditionColumn + . '_conditionvalue'; $conditionsString[] = " $conditionColumn = $key "; $allColumns[$conditionColumn][] = $conditionValue; $params[$key] = $conditionValue; diff --git a/common/report/class.Report.php b/common/report/class.Report.php index ad6f07705..277ad26f6 100755 --- a/common/report/class.Report.php +++ b/common/report/class.Report.php @@ -97,7 +97,13 @@ public function __construct(string $type, string $message = '', $data = null, ar public static function __callStatic(string $name, array $arguments): self { if (strpos($name, 'create') !== 0) { - throw new BadMethodCallException(sprintf('Requested method `%s` is not found or is not allowed in class %s', $name, __CLASS__)); + throw new BadMethodCallException( + sprintf( + 'Requested method `%s` is not found or is not allowed in class %s', + $name, + __CLASS__ + ) + ); } $type = strtolower(str_replace('create', '', $name)); @@ -129,7 +135,13 @@ public function __call(string $name, array $arguments) return $this->handleContainsCalls($name, $arguments); } - throw new BadMethodCallException(sprintf('Requested method `%s` is not found or is not allowed in class %s', $name, __CLASS__)); + throw new BadMethodCallException( + sprintf( + 'Requested method `%s` is not found or is not allowed in class %s', + $name, + __CLASS__ + ) + ); } /** @@ -254,7 +266,9 @@ public function add($mixed): self } elseif ($element instanceof UserReadableException) { $this->children[] = new static(self::TYPE_ERROR, $element->getUserMessage()); } else { - throw new common_exception_Error('Tried to add ' . (is_object($element) ? get_class($element) : gettype($element)) . ' to the report'); + throw new common_exception_Error( + 'Tried to add ' . (is_object($element) ? get_class($element) : gettype($element)) . ' to the report' + ); } } diff --git a/common/session/php/class.KeyValueSessionHandler.php b/common/session/php/class.KeyValueSessionHandler.php index 020a74034..0fed1c430 100644 --- a/common/session/php/class.KeyValueSessionHandler.php +++ b/common/session/php/class.KeyValueSessionHandler.php @@ -40,7 +40,9 @@ class common_session_php_KeyValueSessionHandler extends ConfigurableService impl protected function getPersistence() { if (is_null($this->sessionPersistence)) { - $this->sessionPersistence = common_persistence_KeyValuePersistence::getPersistence($this->getOption(self::OPTION_PERSISTENCE)); + $this->sessionPersistence = common_persistence_KeyValuePersistence::getPersistence( + $this->getOption(self::OPTION_PERSISTENCE) + ); } return $this->sessionPersistence; diff --git a/common/uri/class.MicrotimeUriProvider.php b/common/uri/class.MicrotimeUriProvider.php index c2a20c579..6a6d02e2b 100644 --- a/common/uri/class.MicrotimeUriProvider.php +++ b/common/uri/class.MicrotimeUriProvider.php @@ -59,7 +59,9 @@ public function provide() do { list($usec, $sec) = explode(" ", microtime()); $uri = $modelUri . 'i' . (str_replace(".", "", $sec . "" . $usec)); - $sqlResult = $dbWrapper->query("SELECT COUNT(subject) AS num FROM statements WHERE subject = '" . $uri . "'"); + $sqlResult = $dbWrapper->query( + "SELECT COUNT(subject) AS num FROM statements WHERE subject = '" . $uri . "'" + ); if ($row = $sqlResult->fetch()) { $found = (int)$row['num']; diff --git a/common/user/auth/class.AuthFailedException.php b/common/user/auth/class.AuthFailedException.php index bcc3d2f4e..1fa4b9966 100755 --- a/common/user/auth/class.AuthFailedException.php +++ b/common/user/auth/class.AuthFailedException.php @@ -28,6 +28,7 @@ * @package generis */ -abstract class common_user_auth_AuthFailedException extends common_Exception implements common_exception_UserReadableException +abstract class common_user_auth_AuthFailedException extends common_Exception implements + common_exception_UserReadableException { } diff --git a/config/default/ontology.conf.php b/config/default/ontology.conf.php index 88a9a26be..598dd3e6e 100644 --- a/config/default/ontology.conf.php +++ b/config/default/ontology.conf.php @@ -11,6 +11,8 @@ core_kernel_persistence_smoothsql_SmoothModel::OPTION_WRITEABLE_MODELS => [ core_kernel_persistence_smoothsql_SmoothModel::DEFAULT_WRITABLE_MODEL, ], + // phpcs:disable Generic.Files.LineLength core_kernel_persistence_smoothsql_SmoothModel::OPTION_NEW_TRIPLE_MODEL => core_kernel_persistence_smoothsql_SmoothModel::DEFAULT_WRITABLE_MODEL, + // phpcs:enable Generic.Files.LineLength core_kernel_persistence_smoothsql_SmoothModel::OPTION_SEARCH_SERVICE => ComplexSearchService::SERVICE_ID, ]); diff --git a/helpers/class.ExtensionHelper.php b/helpers/class.ExtensionHelper.php index f89c95529..f9d7feefb 100755 --- a/helpers/class.ExtensionHelper.php +++ b/helpers/class.ExtensionHelper.php @@ -77,9 +77,14 @@ public static function sortByDependencies($extensions) if (count($unsorted) == $before) { $notfound = array_diff($missing, array_keys($unsorted)); if (!empty($notfound)) { - throw new common_exception_Error('Missing extensions ' . implode(',', $notfound) . ' for: ' . implode(',', array_keys($unsorted))); + throw new common_exception_Error( + 'Missing extensions ' . implode(',', $notfound) . ' for: ' + . implode(',', array_keys($unsorted)) + ); } else { - throw new common_exception_Error('Cyclic extension dependencies for: ' . implode(',', array_keys($unsorted))); + throw new common_exception_Error( + 'Cyclic extension dependencies for: ' . implode(',', array_keys($unsorted)) + ); } } } diff --git a/helpers/class.File.php b/helpers/class.File.php index fc9fead3e..ed1f27ff9 100644 --- a/helpers/class.File.php +++ b/helpers/class.File.php @@ -46,7 +46,72 @@ class helpers_File * matches [A-Za-z] | - | _ * @var array */ - private static $ALLOWED_CHARACTERS = ['A' => '','B' => '','C' => '','D' => '','E' => '','F' => '','G' => '','H' => '','I' => '','J' => '','K' => '','L' => '','M' => '','N' => '','O' => '','P' => '','Q' => '','R' => '','S' => '','T' => '','U' => '','V' => '','W' => '','X' => '','Y' => '','Z' => '','a' => '','b' => '','c' => '','d' => '','e' => '','f' => '','g' => '','h' => '','i' => '','j' => '','k' => '','l' => '','m' => '','n' => '','o' => '','p' => '','q' => '','r' => '','s' => '','t' => '','u' => '','v' => '','w' => '','x' => '','y' => '','z' => '',0 => '',1 => '',2 => '',3 => '',4 => '',5 => '',6 => '',7 => '',8 => '',9 => '','_' => '','-' => '']; + private static $ALLOWED_CHARACTERS = [ + 'A' => '', + 'B' => '', + 'C' => '', + 'D' => '', + 'E' => '', + 'F' => '', + 'G' => '', + 'H' => '', + 'I' => '', + 'J' => '', + 'K' => '', + 'L' => '', + 'M' => '', + 'N' => '', + 'O' => '', + 'P' => '', + 'Q' => '', + 'R' => '', + 'S' => '', + 'T' => '', + 'U' => '', + 'V' => '', + 'W' => '', + 'X' => '', + 'Y' => '', + 'Z' => '', + 'a' => '', + 'b' => '', + 'c' => '', + 'd' => '', + 'e' => '', + 'f' => '', + 'g' => '', + 'h' => '', + 'i' => '', + 'j' => '', + 'k' => '', + 'l' => '', + 'm' => '', + 'n' => '', + 'o' => '', + 'p' => '', + 'q' => '', + 'r' => '', + 's' => '', + 't' => '', + 'u' => '', + 'v' => '', + 'w' => '', + 'x' => '', + 'y' => '', + 'z' => '', + 0 => '', + 1 => '', + 2 => '', + 3 => '', + 4 => '', + 5 => '', + 6 => '', + 7 => '', + 8 => '', + 9 => '', + '_' => '', + '-' => '', + ]; /** * Directory Mode @@ -147,7 +212,12 @@ public static function remove($path) $returnValue = unlink($path); } elseif (is_dir($path)) { /* - * //It seems to raise problemes on windows, depending on the php version the resource handler is not freed with DirectoryIterator preventing from further deletions // $iterator = new DirectoryIterator($path); foreach ($iterator as $fileinfo) { if (!$fileinfo->isDot()) { } } + * It seems to raise problemes on windows, depending on the php version the resource handler is not freed + * with DirectoryIterator preventing from further deletions + * $iterator = new DirectoryIterator($path); + * foreach ($iterator as $fileinfo) { + * if (!$fileinfo->isDot()) { } + * } */ $handle = opendir($path); if ($handle !== false) { @@ -163,7 +233,9 @@ public static function remove($path) $returnValue = rmdir($path); } else { - throw new common_exception_Error('"' . $path . '" cannot be removed since it\'s neither a file nor directory'); + throw new common_exception_Error( + '"' . $path . '" cannot be removed since it\'s neither a file nor directory' + ); } return (bool) $returnValue; @@ -312,12 +384,18 @@ public static function scandir($path, $options = []) } if ($fileinfo->isDir() && $recursive) { - $returnValue = array_merge($returnValue, self::scandir(realpath($fileinfo->getPathname()), $options)); + $returnValue = array_merge( + $returnValue, + self::scandir(realpath($fileinfo->getPathname()), $options) + ); } } } } else { - throw new common_Exception("An error occured : The function (" . __METHOD__ . ") of the class (" . __CLASS__ . ") is expecting a directory path as first parameter : " . $path); + throw new common_Exception( + "An error occured : The function (" . __METHOD__ . ") of the class (" . __CLASS__ + . ") is expecting a directory path as first parameter : " . $path + ); } return (array) $returnValue; diff --git a/helpers/class.InstallHelper.php b/helpers/class.InstallHelper.php index 94ee3f283..15e9feb0a 100644 --- a/helpers/class.InstallHelper.php +++ b/helpers/class.InstallHelper.php @@ -88,7 +88,8 @@ public static function installRecursively($extensionIDs, $installData = []) $missing = array_diff($missing, array_keys($toInstall)); foreach ($missing as $extID) { static::log('d', 'Extension ' . $extID . ' is required but missing, added to install list'); - $toInstall = [$extID => common_ext_ExtensionsManager::singleton()->getExtensionById($extID)] + $toInstall; + $toInstall = [$extID => common_ext_ExtensionsManager::singleton()->getExtensionById($extID)] + + $toInstall; $modified = true; } } diff --git a/helpers/class.RdfDiff.php b/helpers/class.RdfDiff.php index ca7617adb..67f89c7cf 100755 --- a/helpers/class.RdfDiff.php +++ b/helpers/class.RdfDiff.php @@ -74,7 +74,12 @@ protected function remove(core_kernel_classes_Triple $triple) protected function generateSerial(core_kernel_classes_Triple $triple) { - return md5(implode(' ', [$triple->subject, $triple->predicate, $triple->object, $triple->lg, $triple->modelid])); + return md5( + implode( + ' ', + [$triple->subject, $triple->predicate, $triple->object, $triple->lg, $triple->modelid] + ) + ); } public function getSummary() @@ -85,10 +90,12 @@ public function getSummary() public function dump() { foreach ($this->toAdd as $triple) { - echo '+ ' . str_pad($triple->subject, 80) . ' ' . str_pad($triple->predicate, 80) . ' ' . str_pad($triple->object, 80) . PHP_EOL; + echo '+ ' . str_pad($triple->subject, 80) . ' ' . str_pad($triple->predicate, 80) . ' ' + . str_pad($triple->object, 80) . PHP_EOL; } foreach ($this->toRemove as $triple) { - echo '- ' . str_pad($triple->subject, 80) . ' ' . str_pad($triple->predicate, 80) . ' ' . str_pad($triple->object, 80) . PHP_EOL; + echo '- ' . str_pad($triple->subject, 80) . ' ' . str_pad($triple->predicate, 80) . ' ' + . str_pad($triple->object, 80) . PHP_EOL; } } diff --git a/helpers/class.Report.php b/helpers/class.Report.php index 448ca28cc..5eb057402 100644 --- a/helpers/class.Report.php +++ b/helpers/class.Report.php @@ -40,8 +40,11 @@ class helpers_Report * @param integer $intend the intend of the message. * @return string The shell output of $report. */ - public static function renderToCommandLine(ReportInterface $report, $useColor = self::AUTOSENSE, $intend = 0): string - { + public static function renderToCommandLine( + ReportInterface $report, + $useColor = self::AUTOSENSE, + $intend = 0 + ): string { switch ($report->getType()) { case ReportInterface::TYPE_SUCCESS: $color = '0;32'; // green diff --git a/helpers/class.VersionedFile.php b/helpers/class.VersionedFile.php index 4c20e9c26..3f451838e 100644 --- a/helpers/class.VersionedFile.php +++ b/helpers/class.VersionedFile.php @@ -120,7 +120,12 @@ public static function cpWorkingCopy($source, $destination, $recursive = true, $ if (!$ignoreSystemFiles && $file[0] == '.') { continue; } else { - self::cpWorkingCopy($source . '/' . $file, $destination . '/' . $file, true, $ignoreSystemFiles); + self::cpWorkingCopy( + $source . '/' . $file, + $destination . '/' . $file, + true, + $ignoreSystemFiles + ); } } } diff --git a/scripts/tools/CleanUpOrphanFiles.php b/scripts/tools/CleanUpOrphanFiles.php index 370eb21a6..c14560afc 100644 --- a/scripts/tools/CleanUpOrphanFiles.php +++ b/scripts/tools/CleanUpOrphanFiles.php @@ -194,7 +194,12 @@ private function manageOrphan(core_kernel_classes_Resource $resource, FileSystem if ($isOrphan && !$file->exists()) { if ($this->verbose) { - $this->report->add(new Report(Report::TYPE_INFO, sprintf('URI %s : File %s', $resource->getUri(), $file->getPrefix()))); + $this->report->add( + new Report( + Report::TYPE_INFO, + sprintf('URI %s : File %s', $resource->getUri(), $file->getPrefix()) + ) + ); } $this->markForRemoval($resource); $this->affectedCount++; @@ -227,10 +232,20 @@ private function prepareReport() $this->report->add(new Report(Report::TYPE_SUCCESS, sprintf('%s redundant at RDS', $this->redundantCount))); $this->report->add(new Report(Report::TYPE_SUCCESS, sprintf('%s missing at FS', $this->affectedCount))); $this->report->add(new Report(Report::TYPE_SUCCESS, sprintf('%s removed at FS', $this->removedCount))); - $this->report->add(new Report(Report::TYPE_SUCCESS, sprintf('Peak memory %s Mb', memory_get_peak_usage() / 1024 / 1024))); + $this->report->add( + new Report( + Report::TYPE_SUCCESS, + sprintf('Peak memory %s Mb', memory_get_peak_usage() / 1024 / 1024) + ) + ); if ($this->errorsCount) { - $this->report->add(new Report(Report::TYPE_ERROR, sprintf('%s errors happened, check details above', $this->errorsCount))); + $this->report->add( + new Report( + Report::TYPE_ERROR, + sprintf('%s errors happened, check details above', $this->errorsCount) + ) + ); } } } diff --git a/scripts/tools/FileSerializerMigration/Migrate.php b/scripts/tools/FileSerializerMigration/Migrate.php index 000844f38..02ec7e567 100644 --- a/scripts/tools/FileSerializerMigration/Migrate.php +++ b/scripts/tools/FileSerializerMigration/Migrate.php @@ -92,7 +92,9 @@ protected function run() $this->report->add(Report::createSuccess('Completed file migration process.')); if (!$this->isWetRun()) { - $this->report->add(Report::createFailure('Use the --wet-run (-w) parameter to execute reference migration.')); + $this->report->add( + Report::createFailure('Use the --wet-run (-w) parameter to execute reference migration.') + ); } return $this->report; @@ -130,7 +132,8 @@ protected function provideOptions() 'flag' => true, 'prefix' => 'w', 'longPrefix' => 'wet-run', - 'description' => 'Add this flag to migrate the references, as opposed to just listing them (dry/wet run)' + 'description' => 'Add this flag to migrate the references, as opposed to just listing them ' + . '(dry/wet run)' ] ]; } diff --git a/scripts/tools/FileSerializerMigration/MigrationHelper.php b/scripts/tools/FileSerializerMigration/MigrationHelper.php index 9d1b371a3..2de29fbcc 100644 --- a/scripts/tools/FileSerializerMigration/MigrationHelper.php +++ b/scripts/tools/FileSerializerMigration/MigrationHelper.php @@ -134,8 +134,11 @@ public function migrateFiles() * @return void * @throws FileSerializerException */ - public function migrateResource(core_kernel_classes_Resource $fileResource, core_kernel_classes_Property $property, core_kernel_classes_Resource $subject) - { + public function migrateResource( + core_kernel_classes_Resource $fileResource, + core_kernel_classes_Property $property, + core_kernel_classes_Resource $subject + ) { /** @var Directory|File $unserializedFileResource */ $unserializedFileResource = $this->getResourceFileSerializer()->unserialize($fileResource); $migratedValue = $this->getUrlFileSerializer()->serialize($unserializedFileResource); diff --git a/scripts/update/Updater.php b/scripts/update/Updater.php index fd13ab5fd..772af36d2 100644 --- a/scripts/update/Updater.php +++ b/scripts/update/Updater.php @@ -130,13 +130,17 @@ public function update($initialVersion) 'search.query.criterion' => '\\oat\\search\\QueryCriterion', 'search.driver.postgres' => '\\oat\\search\\DbSql\\Driver\\PostgreSQL', 'search.driver.mysql' => '\\oat\\search\\DbSql\\Driver\\MySQL', + // phpcs:disable Generic.Files.LineLength 'search.driver.tao' => '\\oat\\generis\\model\\kernel\\persistence\\smoothsql\\search\\driver\\TaoSearchDriver', + // phpcs:enable Generic.Files.LineLength 'search.tao.serialyser' => '\\oat\\search\\DbSql\\TaoRdf\\UnionQuerySerialyser', 'search.factory.query' => '\\oat\\search\\factory\\QueryFactory', 'search.factory.builder' => '\\oat\\search\\factory\\QueryBuilderFactory', 'search.factory.criterion' => '\\oat\\search\\factory\\QueryCriterionFactory', + // phpcs:disable Generic.Files.LineLength 'search.tao.gateway' => '\\oat\\generis\\model\\kernel\\persistence\\smoothsql\\search\\GateWay', 'search.tao.result' => '\\oat\\generis\\model\\kernel\\persistence\\smoothsql\\search\\TaoResultSet', + // phpcs:enable Generic.Files.LineLength ], 'abstract_factories' => [ '\\oat\\search\\Command\\OperatorAbstractfactory',