├── LICENSE
├── README.md
├── app
├── .htaccess
├── Common.php
├── Config
│ ├── App.php
│ ├── Autoload.php
│ ├── Boot
│ │ ├── development.php
│ │ ├── production.php
│ │ └── testing.php
│ ├── CURLRequest.php
│ ├── Cache.php
│ ├── Constants.php
│ ├── ContentSecurityPolicy.php
│ ├── Cookie.php
│ ├── Cors.php
│ ├── Database.php
│ ├── DocTypes.php
│ ├── Email.php
│ ├── Encryption.php
│ ├── Events.php
│ ├── Exceptions.php
│ ├── Feature.php
│ ├── Filters.php
│ ├── ForeignCharacters.php
│ ├── Format.php
│ ├── Generators.php
│ ├── Honeypot.php
│ ├── Images.php
│ ├── Kint.php
│ ├── Logger.php
│ ├── Migrations.php
│ ├── Mimes.php
│ ├── Modules.php
│ ├── Optimize.php
│ ├── Pager.php
│ ├── Paths.php
│ ├── Publisher.php
│ ├── Routes.php
│ ├── Routing.php
│ ├── Security.php
│ ├── Services.php
│ ├── Session.php
│ ├── Toolbar.php
│ ├── UserAgents.php
│ ├── Validation.php
│ └── View.php
├── Controllers
│ ├── BaseController.php
│ └── Home.php
├── Database
│ ├── Migrations
│ │ └── .gitkeep
│ └── Seeds
│ │ └── .gitkeep
├── Filters
│ └── .gitkeep
├── Helpers
│ └── .gitkeep
├── Language
│ ├── .gitkeep
│ └── en
│ │ └── Validation.php
├── Libraries
│ └── .gitkeep
├── Models
│ └── .gitkeep
├── ThirdParty
│ └── .gitkeep
├── Views
│ ├── errors
│ │ ├── cli
│ │ │ ├── error_404.php
│ │ │ ├── error_exception.php
│ │ │ └── production.php
│ │ └── html
│ │ │ ├── debug.css
│ │ │ ├── debug.js
│ │ │ ├── error_400.php
│ │ │ ├── error_404.php
│ │ │ ├── error_exception.php
│ │ │ └── production.php
│ └── welcome_message.php
└── index.html
├── composer.json
├── env
├── phpunit.xml.dist
├── preload.php
├── public
├── .htaccess
├── favicon.ico
├── index.php
└── robots.txt
├── spark
├── system
├── .htaccess
├── API
│ └── ResponseTrait.php
├── Autoloader
│ ├── Autoloader.php
│ ├── FileLocator.php
│ ├── FileLocatorCached.php
│ └── FileLocatorInterface.php
├── BaseModel.php
├── Boot.php
├── CLI
│ ├── BaseCommand.php
│ ├── CLI.php
│ ├── Commands.php
│ ├── Console.php
│ ├── Exceptions
│ │ └── CLIException.php
│ ├── GeneratorTrait.php
│ └── InputOutput.php
├── Cache
│ ├── CacheFactory.php
│ ├── CacheInterface.php
│ ├── Exceptions
│ │ └── CacheException.php
│ ├── FactoriesCache.php
│ ├── FactoriesCache
│ │ └── FileVarExportHandler.php
│ ├── Handlers
│ │ ├── BaseHandler.php
│ │ ├── DummyHandler.php
│ │ ├── FileHandler.php
│ │ ├── MemcachedHandler.php
│ │ ├── PredisHandler.php
│ │ ├── RedisHandler.php
│ │ └── WincacheHandler.php
│ └── ResponseCache.php
├── CodeIgniter.php
├── Commands
│ ├── Cache
│ │ ├── ClearCache.php
│ │ └── InfoCache.php
│ ├── Database
│ │ ├── CreateDatabase.php
│ │ ├── Migrate.php
│ │ ├── MigrateRefresh.php
│ │ ├── MigrateRollback.php
│ │ ├── MigrateStatus.php
│ │ ├── Seed.php
│ │ └── ShowTableInfo.php
│ ├── Encryption
│ │ └── GenerateKey.php
│ ├── Generators
│ │ ├── CellGenerator.php
│ │ ├── CommandGenerator.php
│ │ ├── ConfigGenerator.php
│ │ ├── ControllerGenerator.php
│ │ ├── EntityGenerator.php
│ │ ├── FilterGenerator.php
│ │ ├── MigrationGenerator.php
│ │ ├── ModelGenerator.php
│ │ ├── ScaffoldGenerator.php
│ │ ├── SeederGenerator.php
│ │ ├── TestGenerator.php
│ │ ├── ValidationGenerator.php
│ │ └── Views
│ │ │ ├── cell.tpl.php
│ │ │ ├── cell_view.tpl.php
│ │ │ ├── command.tpl.php
│ │ │ ├── config.tpl.php
│ │ │ ├── controller.tpl.php
│ │ │ ├── entity.tpl.php
│ │ │ ├── filter.tpl.php
│ │ │ ├── migration.tpl.php
│ │ │ ├── model.tpl.php
│ │ │ ├── seeder.tpl.php
│ │ │ ├── test.tpl.php
│ │ │ └── validation.tpl.php
│ ├── Help.php
│ ├── Housekeeping
│ │ ├── ClearDebugbar.php
│ │ └── ClearLogs.php
│ ├── ListCommands.php
│ ├── Server
│ │ └── Serve.php
│ ├── Translation
│ │ ├── LocalizationFinder.php
│ │ └── LocalizationSync.php
│ └── Utilities
│ │ ├── ConfigCheck.php
│ │ ├── Environment.php
│ │ ├── FilterCheck.php
│ │ ├── Namespaces.php
│ │ ├── Optimize.php
│ │ ├── PhpIniCheck.php
│ │ ├── Publish.php
│ │ ├── Routes.php
│ │ └── Routes
│ │ ├── AutoRouteCollector.php
│ │ ├── AutoRouterImproved
│ │ ├── AutoRouteCollector.php
│ │ └── ControllerMethodReader.php
│ │ ├── ControllerFinder.php
│ │ ├── ControllerMethodReader.php
│ │ ├── FilterCollector.php
│ │ ├── FilterFinder.php
│ │ └── SampleURIGenerator.php
├── Common.php
├── ComposerScripts.php
├── Config
│ ├── AutoloadConfig.php
│ ├── BaseConfig.php
│ ├── BaseService.php
│ ├── DotEnv.php
│ ├── Factories.php
│ ├── Factory.php
│ ├── Filters.php
│ ├── ForeignCharacters.php
│ ├── Publisher.php
│ ├── Routing.php
│ ├── Services.php
│ └── View.php
├── Controller.php
├── Cookie
│ ├── CloneableCookieInterface.php
│ ├── Cookie.php
│ ├── CookieInterface.php
│ ├── CookieStore.php
│ └── Exceptions
│ │ └── CookieException.php
├── DataCaster
│ ├── Cast
│ │ ├── ArrayCast.php
│ │ ├── BaseCast.php
│ │ ├── BooleanCast.php
│ │ ├── CSVCast.php
│ │ ├── CastInterface.php
│ │ ├── DatetimeCast.php
│ │ ├── FloatCast.php
│ │ ├── IntBoolCast.php
│ │ ├── IntegerCast.php
│ │ ├── JsonCast.php
│ │ ├── TimestampCast.php
│ │ └── URICast.php
│ ├── DataCaster.php
│ └── Exceptions
│ │ └── CastException.php
├── DataConverter
│ └── DataConverter.php
├── Database
│ ├── BaseBuilder.php
│ ├── BaseConnection.php
│ ├── BasePreparedQuery.php
│ ├── BaseResult.php
│ ├── BaseUtils.php
│ ├── Config.php
│ ├── ConnectionInterface.php
│ ├── Database.php
│ ├── Exceptions
│ │ ├── DataException.php
│ │ ├── DatabaseException.php
│ │ └── ExceptionInterface.php
│ ├── Forge.php
│ ├── Migration.php
│ ├── MigrationRunner.php
│ ├── MySQLi
│ │ ├── Builder.php
│ │ ├── Connection.php
│ │ ├── Forge.php
│ │ ├── PreparedQuery.php
│ │ ├── Result.php
│ │ └── Utils.php
│ ├── OCI8
│ │ ├── Builder.php
│ │ ├── Connection.php
│ │ ├── Forge.php
│ │ ├── PreparedQuery.php
│ │ ├── Result.php
│ │ └── Utils.php
│ ├── Postgre
│ │ ├── Builder.php
│ │ ├── Connection.php
│ │ ├── Forge.php
│ │ ├── PreparedQuery.php
│ │ ├── Result.php
│ │ └── Utils.php
│ ├── PreparedQueryInterface.php
│ ├── Query.php
│ ├── QueryInterface.php
│ ├── RawSql.php
│ ├── ResultInterface.php
│ ├── SQLSRV
│ │ ├── Builder.php
│ │ ├── Connection.php
│ │ ├── Forge.php
│ │ ├── PreparedQuery.php
│ │ ├── Result.php
│ │ └── Utils.php
│ ├── SQLite3
│ │ ├── Builder.php
│ │ ├── Connection.php
│ │ ├── Forge.php
│ │ ├── PreparedQuery.php
│ │ ├── Result.php
│ │ ├── Table.php
│ │ └── Utils.php
│ ├── Seeder.php
│ └── TableName.php
├── Debug
│ ├── BaseExceptionHandler.php
│ ├── ExceptionHandler.php
│ ├── ExceptionHandlerInterface.php
│ ├── Exceptions.php
│ ├── Iterator.php
│ ├── Timer.php
│ ├── Toolbar.php
│ └── Toolbar
│ │ ├── Collectors
│ │ ├── BaseCollector.php
│ │ ├── Config.php
│ │ ├── Database.php
│ │ ├── Events.php
│ │ ├── Files.php
│ │ ├── History.php
│ │ ├── Logs.php
│ │ ├── Routes.php
│ │ ├── Timers.php
│ │ └── Views.php
│ │ └── Views
│ │ ├── _config.tpl
│ │ ├── _database.tpl
│ │ ├── _events.tpl
│ │ ├── _files.tpl
│ │ ├── _history.tpl
│ │ ├── _logs.tpl
│ │ ├── _routes.tpl
│ │ ├── toolbar.css
│ │ ├── toolbar.js
│ │ ├── toolbar.tpl.php
│ │ └── toolbarloader.js
├── Email
│ └── Email.php
├── Encryption
│ ├── EncrypterInterface.php
│ ├── Encryption.php
│ ├── Exceptions
│ │ └── EncryptionException.php
│ └── Handlers
│ │ ├── BaseHandler.php
│ │ ├── OpenSSLHandler.php
│ │ └── SodiumHandler.php
├── Entity
│ ├── Cast
│ │ ├── ArrayCast.php
│ │ ├── BaseCast.php
│ │ ├── BooleanCast.php
│ │ ├── CSVCast.php
│ │ ├── CastInterface.php
│ │ ├── DatetimeCast.php
│ │ ├── FloatCast.php
│ │ ├── IntBoolCast.php
│ │ ├── IntegerCast.php
│ │ ├── JsonCast.php
│ │ ├── ObjectCast.php
│ │ ├── StringCast.php
│ │ ├── TimestampCast.php
│ │ └── URICast.php
│ ├── Entity.php
│ └── Exceptions
│ │ └── CastException.php
├── Events
│ └── Events.php
├── Exceptions
│ ├── BadFunctionCallException.php
│ ├── BadMethodCallException.php
│ ├── ConfigException.php
│ ├── CriticalError.php
│ ├── DebugTraceableTrait.php
│ ├── DownloadException.php
│ ├── ExceptionInterface.php
│ ├── FrameworkException.php
│ ├── HTTPExceptionInterface.php
│ ├── HasExitCodeInterface.php
│ ├── InvalidArgumentException.php
│ ├── LogicException.php
│ ├── ModelException.php
│ ├── PageNotFoundException.php
│ ├── RuntimeException.php
│ └── TestException.php
├── Files
│ ├── Exceptions
│ │ ├── ExceptionInterface.php
│ │ ├── FileException.php
│ │ └── FileNotFoundException.php
│ ├── File.php
│ ├── FileCollection.php
│ └── FileSizeUnit.php
├── Filters
│ ├── CSRF.php
│ ├── Cors.php
│ ├── DebugToolbar.php
│ ├── Exceptions
│ │ └── FilterException.php
│ ├── FilterInterface.php
│ ├── Filters.php
│ ├── ForceHTTPS.php
│ ├── Honeypot.php
│ ├── InvalidChars.php
│ ├── PageCache.php
│ ├── PerformanceMetrics.php
│ └── SecureHeaders.php
├── Format
│ ├── Exceptions
│ │ └── FormatException.php
│ ├── Format.php
│ ├── FormatterInterface.php
│ ├── JSONFormatter.php
│ └── XMLFormatter.php
├── HTTP
│ ├── CLIRequest.php
│ ├── CURLRequest.php
│ ├── ContentSecurityPolicy.php
│ ├── Cors.php
│ ├── DownloadResponse.php
│ ├── Exceptions
│ │ ├── BadRequestException.php
│ │ ├── ExceptionInterface.php
│ │ ├── HTTPException.php
│ │ └── RedirectException.php
│ ├── Files
│ │ ├── FileCollection.php
│ │ ├── UploadedFile.php
│ │ └── UploadedFileInterface.php
│ ├── Header.php
│ ├── IncomingRequest.php
│ ├── Message.php
│ ├── MessageInterface.php
│ ├── MessageTrait.php
│ ├── Method.php
│ ├── Negotiate.php
│ ├── OutgoingRequest.php
│ ├── OutgoingRequestInterface.php
│ ├── RedirectResponse.php
│ ├── Request.php
│ ├── RequestInterface.php
│ ├── RequestTrait.php
│ ├── ResponsableInterface.php
│ ├── Response.php
│ ├── ResponseInterface.php
│ ├── ResponseTrait.php
│ ├── SiteURI.php
│ ├── SiteURIFactory.php
│ ├── URI.php
│ └── UserAgent.php
├── Helpers
│ ├── Array
│ │ └── ArrayHelper.php
│ ├── array_helper.php
│ ├── cookie_helper.php
│ ├── date_helper.php
│ ├── filesystem_helper.php
│ ├── form_helper.php
│ ├── html_helper.php
│ ├── inflector_helper.php
│ ├── kint_helper.php
│ ├── number_helper.php
│ ├── security_helper.php
│ ├── test_helper.php
│ ├── text_helper.php
│ ├── url_helper.php
│ └── xml_helper.php
├── Honeypot
│ ├── Exceptions
│ │ └── HoneypotException.php
│ └── Honeypot.php
├── HotReloader
│ ├── DirectoryHasher.php
│ ├── HotReloader.php
│ └── IteratorFilter.php
├── I18n
│ ├── Exceptions
│ │ └── I18nException.php
│ ├── Time.php
│ ├── TimeDifference.php
│ ├── TimeLegacy.php
│ └── TimeTrait.php
├── Images
│ ├── Exceptions
│ │ └── ImageException.php
│ ├── Handlers
│ │ ├── BaseHandler.php
│ │ ├── GDHandler.php
│ │ └── ImageMagickHandler.php
│ ├── Image.php
│ └── ImageHandlerInterface.php
├── Language
│ ├── Language.php
│ └── en
│ │ ├── CLI.php
│ │ ├── Cache.php
│ │ ├── Cast.php
│ │ ├── Cookie.php
│ │ ├── Core.php
│ │ ├── Database.php
│ │ ├── Email.php
│ │ ├── Encryption.php
│ │ ├── Errors.php
│ │ ├── Fabricator.php
│ │ ├── Files.php
│ │ ├── Filters.php
│ │ ├── Format.php
│ │ ├── HTTP.php
│ │ ├── Images.php
│ │ ├── Language.php
│ │ ├── Log.php
│ │ ├── Migrations.php
│ │ ├── Number.php
│ │ ├── Pager.php
│ │ ├── Publisher.php
│ │ ├── RESTful.php
│ │ ├── Router.php
│ │ ├── Security.php
│ │ ├── Session.php
│ │ ├── Test.php
│ │ ├── Time.php
│ │ ├── Validation.php
│ │ └── View.php
├── Log
│ ├── Exceptions
│ │ └── LogException.php
│ ├── Handlers
│ │ ├── BaseHandler.php
│ │ ├── ChromeLoggerHandler.php
│ │ ├── ErrorlogHandler.php
│ │ ├── FileHandler.php
│ │ └── HandlerInterface.php
│ └── Logger.php
├── Model.php
├── Modules
│ └── Modules.php
├── Pager
│ ├── Exceptions
│ │ └── PagerException.php
│ ├── Pager.php
│ ├── PagerInterface.php
│ ├── PagerRenderer.php
│ └── Views
│ │ ├── default_full.php
│ │ ├── default_head.php
│ │ └── default_simple.php
├── Publisher
│ ├── ContentReplacer.php
│ ├── Exceptions
│ │ └── PublisherException.php
│ └── Publisher.php
├── RESTful
│ ├── BaseResource.php
│ ├── ResourceController.php
│ └── ResourcePresenter.php
├── Router
│ ├── AutoRouter.php
│ ├── AutoRouterImproved.php
│ ├── AutoRouterInterface.php
│ ├── DefinedRouteCollector.php
│ ├── Exceptions
│ │ ├── ExceptionInterface.php
│ │ ├── MethodNotFoundException.php
│ │ └── RouterException.php
│ ├── RouteCollection.php
│ ├── RouteCollectionInterface.php
│ ├── Router.php
│ └── RouterInterface.php
├── Security
│ ├── CheckPhpIni.php
│ ├── Exceptions
│ │ └── SecurityException.php
│ ├── Security.php
│ └── SecurityInterface.php
├── Session
│ ├── Exceptions
│ │ └── SessionException.php
│ ├── Handlers
│ │ ├── ArrayHandler.php
│ │ ├── BaseHandler.php
│ │ ├── Database
│ │ │ ├── MySQLiHandler.php
│ │ │ └── PostgreHandler.php
│ │ ├── DatabaseHandler.php
│ │ ├── FileHandler.php
│ │ ├── MemcachedHandler.php
│ │ └── RedisHandler.php
│ ├── Session.php
│ └── SessionInterface.php
├── Superglobals.php
├── Test
│ ├── CIUnitTestCase.php
│ ├── ConfigFromArrayTrait.php
│ ├── Constraints
│ │ └── SeeInDatabase.php
│ ├── ControllerTestTrait.php
│ ├── DOMParser.php
│ ├── DatabaseTestTrait.php
│ ├── Fabricator.php
│ ├── FeatureTestTrait.php
│ ├── FilterTestTrait.php
│ ├── Filters
│ │ └── CITestStreamFilter.php
│ ├── IniTestTrait.php
│ ├── Interfaces
│ │ └── FabricatorModel.php
│ ├── Mock
│ │ ├── MockAppConfig.php
│ │ ├── MockAutoload.php
│ │ ├── MockBuilder.php
│ │ ├── MockCLIConfig.php
│ │ ├── MockCURLRequest.php
│ │ ├── MockCache.php
│ │ ├── MockCodeIgniter.php
│ │ ├── MockCommon.php
│ │ ├── MockConnection.php
│ │ ├── MockEmail.php
│ │ ├── MockEvents.php
│ │ ├── MockFileLogger.php
│ │ ├── MockIncomingRequest.php
│ │ ├── MockInputOutput.php
│ │ ├── MockLanguage.php
│ │ ├── MockLogger.php
│ │ ├── MockQuery.php
│ │ ├── MockResourceController.php
│ │ ├── MockResourcePresenter.php
│ │ ├── MockResponse.php
│ │ ├── MockResult.php
│ │ ├── MockSecurity.php
│ │ ├── MockServices.php
│ │ ├── MockSession.php
│ │ └── MockTable.php
│ ├── PhpStreamWrapper.php
│ ├── ReflectionHelper.php
│ ├── StreamFilterTrait.php
│ ├── TestLogger.php
│ ├── TestResponse.php
│ └── bootstrap.php
├── ThirdParty
│ ├── Escaper
│ │ ├── Escaper.php
│ │ ├── Exception
│ │ │ ├── ExceptionInterface.php
│ │ │ ├── InvalidArgumentException.php
│ │ │ └── RuntimeException.php
│ │ └── LICENSE.md
│ ├── Kint
│ │ ├── CallFinder.php
│ │ ├── FacadeInterface.php
│ │ ├── Kint.php
│ │ ├── LICENSE
│ │ ├── Parser
│ │ │ ├── AbstractPlugin.php
│ │ │ ├── ArrayLimitPlugin.php
│ │ │ ├── ArrayObjectPlugin.php
│ │ │ ├── Base64Plugin.php
│ │ │ ├── BinaryPlugin.php
│ │ │ ├── BlacklistPlugin.php
│ │ │ ├── ClassHooksPlugin.php
│ │ │ ├── ClassMethodsPlugin.php
│ │ │ ├── ClassStaticsPlugin.php
│ │ │ ├── ClassStringsPlugin.php
│ │ │ ├── ClosurePlugin.php
│ │ │ ├── ColorPlugin.php
│ │ │ ├── ConstructablePluginInterface.php
│ │ │ ├── DateTimePlugin.php
│ │ │ ├── DomPlugin.php
│ │ │ ├── EnumPlugin.php
│ │ │ ├── FsPathPlugin.php
│ │ │ ├── HtmlPlugin.php
│ │ │ ├── IteratorPlugin.php
│ │ │ ├── JsonPlugin.php
│ │ │ ├── MicrotimePlugin.php
│ │ │ ├── MysqliPlugin.php
│ │ │ ├── Parser.php
│ │ │ ├── PluginBeginInterface.php
│ │ │ ├── PluginCompleteInterface.php
│ │ │ ├── PluginInterface.php
│ │ │ ├── ProfilePlugin.php
│ │ │ ├── ProxyPlugin.php
│ │ │ ├── SerializePlugin.php
│ │ │ ├── SimpleXMLElementPlugin.php
│ │ │ ├── SplFileInfoPlugin.php
│ │ │ ├── StreamPlugin.php
│ │ │ ├── TablePlugin.php
│ │ │ ├── ThrowablePlugin.php
│ │ │ ├── TimestampPlugin.php
│ │ │ ├── ToStringPlugin.php
│ │ │ ├── TracePlugin.php
│ │ │ └── XmlPlugin.php
│ │ ├── Renderer
│ │ │ ├── AbstractRenderer.php
│ │ │ ├── AssetRendererTrait.php
│ │ │ ├── CliRenderer.php
│ │ │ ├── ConstructableRendererInterface.php
│ │ │ ├── PlainRenderer.php
│ │ │ ├── RendererInterface.php
│ │ │ ├── Rich
│ │ │ │ ├── AbstractPlugin.php
│ │ │ │ ├── BinaryPlugin.php
│ │ │ │ ├── CallableDefinitionPlugin.php
│ │ │ │ ├── CallablePlugin.php
│ │ │ │ ├── ColorPlugin.php
│ │ │ │ ├── LockPlugin.php
│ │ │ │ ├── MicrotimePlugin.php
│ │ │ │ ├── PluginInterface.php
│ │ │ │ ├── ProfilePlugin.php
│ │ │ │ ├── SourcePlugin.php
│ │ │ │ ├── TabPluginInterface.php
│ │ │ │ ├── TablePlugin.php
│ │ │ │ ├── TraceFramePlugin.php
│ │ │ │ └── ValuePluginInterface.php
│ │ │ ├── RichRenderer.php
│ │ │ ├── Text
│ │ │ │ ├── AbstractPlugin.php
│ │ │ │ ├── LockPlugin.php
│ │ │ │ ├── MicrotimePlugin.php
│ │ │ │ ├── PluginInterface.php
│ │ │ │ ├── SplFileInfoPlugin.php
│ │ │ │ └── TracePlugin.php
│ │ │ └── TextRenderer.php
│ │ ├── Utils.php
│ │ ├── Value
│ │ │ ├── AbstractValue.php
│ │ │ ├── ArrayValue.php
│ │ │ ├── ClosedResourceValue.php
│ │ │ ├── ClosureValue.php
│ │ │ ├── ColorValue.php
│ │ │ ├── Context
│ │ │ │ ├── ArrayContext.php
│ │ │ │ ├── BaseContext.php
│ │ │ │ ├── ClassConstContext.php
│ │ │ │ ├── ClassDeclaredContext.php
│ │ │ │ ├── ClassOwnedContext.php
│ │ │ │ ├── ContextInterface.php
│ │ │ │ ├── DoubleAccessMemberContext.php
│ │ │ │ ├── MethodContext.php
│ │ │ │ ├── PropertyContext.php
│ │ │ │ └── StaticPropertyContext.php
│ │ │ ├── DateTimeValue.php
│ │ │ ├── DeclaredCallableBag.php
│ │ │ ├── DomNodeListValue.php
│ │ │ ├── DomNodeValue.php
│ │ │ ├── EnumValue.php
│ │ │ ├── FixedWidthValue.php
│ │ │ ├── FunctionValue.php
│ │ │ ├── InstanceValue.php
│ │ │ ├── MethodValue.php
│ │ │ ├── MicrotimeValue.php
│ │ │ ├── ParameterBag.php
│ │ │ ├── ParameterHoldingTrait.php
│ │ │ ├── Representation
│ │ │ │ ├── AbstractRepresentation.php
│ │ │ │ ├── BinaryRepresentation.php
│ │ │ │ ├── CallableDefinitionRepresentation.php
│ │ │ │ ├── ColorRepresentation.php
│ │ │ │ ├── ContainerRepresentation.php
│ │ │ │ ├── MicrotimeRepresentation.php
│ │ │ │ ├── ProfileRepresentation.php
│ │ │ │ ├── RepresentationInterface.php
│ │ │ │ ├── SourceRepresentation.php
│ │ │ │ ├── SplFileInfoRepresentation.php
│ │ │ │ ├── StringRepresentation.php
│ │ │ │ ├── TableRepresentation.php
│ │ │ │ └── ValueRepresentation.php
│ │ │ ├── ResourceValue.php
│ │ │ ├── SimpleXMLElementValue.php
│ │ │ ├── SplFileInfoValue.php
│ │ │ ├── StreamValue.php
│ │ │ ├── StringValue.php
│ │ │ ├── ThrowableValue.php
│ │ │ ├── TraceFrameValue.php
│ │ │ ├── TraceValue.php
│ │ │ ├── UninitializedValue.php
│ │ │ ├── UnknownValue.php
│ │ │ └── VirtualValue.php
│ │ ├── init.php
│ │ ├── init_helpers.php
│ │ └── resources
│ │ │ └── compiled
│ │ │ ├── aante-dark.css
│ │ │ ├── aante-light.css
│ │ │ ├── main.js
│ │ │ ├── original.css
│ │ │ ├── plain.css
│ │ │ ├── solarized-dark.css
│ │ │ └── solarized.css
│ └── PSR
│ │ └── Log
│ │ ├── AbstractLogger.php
│ │ ├── InvalidArgumentException.php
│ │ ├── LICENSE
│ │ ├── LogLevel.php
│ │ ├── LoggerAwareInterface.php
│ │ ├── LoggerAwareTrait.php
│ │ ├── LoggerInterface.php
│ │ ├── LoggerTrait.php
│ │ └── NullLogger.php
├── Throttle
│ ├── Throttler.php
│ └── ThrottlerInterface.php
├── Traits
│ ├── ConditionalTrait.php
│ └── PropertiesTrait.php
├── Typography
│ └── Typography.php
├── Validation
│ ├── CreditCardRules.php
│ ├── DotArrayFilter.php
│ ├── Exceptions
│ │ └── ValidationException.php
│ ├── FileRules.php
│ ├── FormatRules.php
│ ├── Rules.php
│ ├── StrictRules
│ │ ├── CreditCardRules.php
│ │ ├── FileRules.php
│ │ ├── FormatRules.php
│ │ └── Rules.php
│ ├── Validation.php
│ ├── ValidationInterface.php
│ └── Views
│ │ ├── list.php
│ │ └── single.php
├── View
│ ├── Cell.php
│ ├── Cells
│ │ └── Cell.php
│ ├── Exceptions
│ │ └── ViewException.php
│ ├── Filters.php
│ ├── Parser.php
│ ├── Plugins.php
│ ├── RendererInterface.php
│ ├── Table.php
│ ├── View.php
│ ├── ViewDecoratorInterface.php
│ └── ViewDecoratorTrait.php
├── bootstrap.php
├── index.html
└── rewrite.php
├── tests
├── .htaccess
├── README.md
├── _support
│ ├── Database
│ │ ├── Migrations
│ │ │ └── 2020-02-22-222222_example_migration.php
│ │ └── Seeds
│ │ │ └── ExampleSeeder.php
│ ├── Libraries
│ │ └── ConfigReader.php
│ └── Models
│ │ └── ExampleModel.php
├── database
│ └── ExampleDatabaseTest.php
├── index.html
├── session
│ └── ExampleSessionTest.php
└── unit
│ └── HealthTest.php
└── writable
├── .htaccess
├── cache
└── index.html
├── index.html
├── logs
└── index.html
├── session
└── index.html
└── uploads
└── index.html
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2014-2019 British Columbia Institute of Technology
4 | Copyright (c) 2019-present CodeIgniter Foundation
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in
14 | all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | THE SOFTWARE.
23 |
--------------------------------------------------------------------------------
/app/.htaccess:
--------------------------------------------------------------------------------
1 |
2 | Require all denied
3 |
4 |
5 | Deny from all
6 |
7 |
--------------------------------------------------------------------------------
/app/Common.php:
--------------------------------------------------------------------------------
1 | {label}';
28 |
29 | /**
30 | * Honeypot container
31 | *
32 | * If you enabled CSP, you can remove `style="display:none"`.
33 | */
34 | public string $container = '
{template}
';
35 |
36 | /**
37 | * The id attribute for Honeypot container tag
38 | *
39 | * Used when CSP is enabled.
40 | */
41 | public string $containerId = 'hpc';
42 | }
43 |
--------------------------------------------------------------------------------
/app/Config/Images.php:
--------------------------------------------------------------------------------
1 |
26 | */
27 | public array $handlers = [
28 | 'gd' => GDHandler::class,
29 | 'imagick' => ImageMagickHandler::class,
30 | ];
31 | }
32 |
--------------------------------------------------------------------------------
/app/Config/Optimize.php:
--------------------------------------------------------------------------------
1 |
22 | */
23 | public array $templates = [
24 | 'default_full' => 'CodeIgniter\Pager\Views\default_full',
25 | 'default_simple' => 'CodeIgniter\Pager\Views\default_simple',
26 | 'default_head' => 'CodeIgniter\Pager\Views\default_head',
27 | ];
28 |
29 | /**
30 | * --------------------------------------------------------------------------
31 | * Items Per Page
32 | * --------------------------------------------------------------------------
33 | *
34 | * The default number of results shown in a single page.
35 | */
36 | public int $perPage = 20;
37 | }
38 |
--------------------------------------------------------------------------------
/app/Config/Publisher.php:
--------------------------------------------------------------------------------
1 |
23 | */
24 | public $restrictions = [
25 | ROOTPATH => '*',
26 | FCPATH => '#\.(s?css|js|map|html?|xml|json|webmanifest|ttf|eot|woff2?|gif|jpe?g|tiff?|png|webp|bmp|ico|svg)$#i',
27 | ];
28 | }
29 |
--------------------------------------------------------------------------------
/app/Config/Routes.php:
--------------------------------------------------------------------------------
1 | get('/', 'Home::index');
9 |
--------------------------------------------------------------------------------
/app/Config/Services.php:
--------------------------------------------------------------------------------
1 |
22 | */
23 | public array $ruleSets = [
24 | Rules::class,
25 | FormatRules::class,
26 | FileRules::class,
27 | CreditCardRules::class,
28 | ];
29 |
30 | /**
31 | * Specifies the views that are used to display the
32 | * errors.
33 | *
34 | * @var array
35 | */
36 | public array $templates = [
37 | 'list' => 'CodeIgniter\Validation\Views\list',
38 | 'single' => 'CodeIgniter\Validation\Views\single',
39 | ];
40 |
41 | // --------------------------------------------------------------------
42 | // Rules
43 | // --------------------------------------------------------------------
44 | }
45 |
--------------------------------------------------------------------------------
/app/Controllers/Home.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | = lang('Errors.whoops') ?>
8 |
9 |
12 |
13 |
14 |
15 |
16 |
17 |
= lang('Errors.whoops') ?>
18 |
19 |
= lang('Errors.weHitASnag') ?>
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/app/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 403 Forbidden
5 |
6 |
7 |
8 | Directory access is forbidden.
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeigniter4/framework/d021b04fdf23afc85d8a8b9b541be9a0a9ccdb5f/public/favicon.ico
--------------------------------------------------------------------------------
/public/robots.txt:
--------------------------------------------------------------------------------
1 | User-agent: *
2 | Disallow:
3 |
--------------------------------------------------------------------------------
/system/.htaccess:
--------------------------------------------------------------------------------
1 |
2 | Require all denied
3 |
4 |
5 | Deny from all
6 |
7 |
--------------------------------------------------------------------------------
/system/CLI/Exceptions/CLIException.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\CLI\Exceptions;
15 |
16 | use CodeIgniter\Exceptions\DebugTraceableTrait;
17 | use CodeIgniter\Exceptions\RuntimeException;
18 |
19 | /**
20 | * CLIException
21 | */
22 | class CLIException extends RuntimeException
23 | {
24 | use DebugTraceableTrait;
25 |
26 | /**
27 | * Thrown when `$color` specified for `$type` is not within the
28 | * allowed list of colors.
29 | *
30 | * @return CLIException
31 | */
32 | public static function forInvalidColor(string $type, string $color)
33 | {
34 | return new static(lang('CLI.invalidColor', [$type, $color]));
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/system/Cache/FactoriesCache/FileVarExportHandler.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\Cache\FactoriesCache;
15 |
16 | final class FileVarExportHandler
17 | {
18 | private string $path = WRITEPATH . 'cache';
19 |
20 | /**
21 | * @param array|bool|float|int|object|string|null $val
22 | */
23 | public function save(string $key, $val): void
24 | {
25 | $val = var_export($val, true);
26 |
27 | // Write to temp file first to ensure atomicity
28 | $tmp = $this->path . "/{$key}." . uniqid('', true) . '.tmp';
29 | file_put_contents($tmp, 'path . "/{$key}");
32 | }
33 |
34 | public function delete(string $key): void
35 | {
36 | @unlink($this->path . "/{$key}");
37 | }
38 |
39 | /**
40 | * @return array|bool|float|int|object|string|null
41 | */
42 | public function get(string $key)
43 | {
44 | return @include $this->path . "/{$key}";
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/system/Commands/Generators/Views/cell.tpl.php:
--------------------------------------------------------------------------------
1 | <@php
2 |
3 | namespace {namespace};
4 |
5 | use CodeIgniter\View\Cells\Cell;
6 |
7 | class {class} extends Cell
8 | {
9 | //
10 | }
11 |
--------------------------------------------------------------------------------
/system/Commands/Generators/Views/cell_view.tpl.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/system/Commands/Generators/Views/command.tpl.php:
--------------------------------------------------------------------------------
1 | <@php
2 |
3 | namespace {namespace};
4 |
5 | use CodeIgniter\CLI\BaseCommand;
6 | use CodeIgniter\CLI\CLI;
7 |
8 | use CodeIgniter\CLI\GeneratorTrait;
9 |
10 |
11 | class {class} extends BaseCommand
12 | {
13 |
14 | use GeneratorTrait;
15 |
16 |
17 | /**
18 | * The Command's Group
19 | *
20 | * @var string
21 | */
22 | protected $group = '{group}';
23 |
24 | /**
25 | * The Command's Name
26 | *
27 | * @var string
28 | */
29 | protected $name = '{command}';
30 |
31 | /**
32 | * The Command's Description
33 | *
34 | * @var string
35 | */
36 | protected $description = '';
37 |
38 | /**
39 | * The Command's Usage
40 | *
41 | * @var string
42 | */
43 | protected $usage = '{command} [arguments] [options]';
44 |
45 | /**
46 | * The Command's Arguments
47 | *
48 | * @var array
49 | */
50 | protected $arguments = [];
51 |
52 | /**
53 | * The Command's Options
54 | *
55 | * @var array
56 | */
57 | protected $options = [];
58 |
59 | /**
60 | * Actually execute a command.
61 | *
62 | * @param array $params
63 | */
64 | public function run(array $params)
65 | {
66 |
67 | $this->component = 'Command';
68 | $this->directory = 'Commands';
69 | $this->template = 'command.tpl.php';
70 |
71 | $this->execute($params);
72 |
73 | //
74 |
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/system/Commands/Generators/Views/config.tpl.php:
--------------------------------------------------------------------------------
1 | <@php
2 |
3 | namespace {namespace};
4 |
5 | use CodeIgniter\Config\BaseConfig;
6 |
7 | class {class} extends BaseConfig
8 | {
9 | //
10 | }
11 |
--------------------------------------------------------------------------------
/system/Commands/Generators/Views/entity.tpl.php:
--------------------------------------------------------------------------------
1 | <@php
2 |
3 | namespace {namespace};
4 |
5 | use CodeIgniter\Entity\Entity;
6 |
7 | class {class} extends Entity
8 | {
9 | protected $datamap = [];
10 | protected $dates = ['created_at', 'updated_at', 'deleted_at'];
11 | protected $casts = [];
12 | }
13 |
--------------------------------------------------------------------------------
/system/Commands/Generators/Views/filter.tpl.php:
--------------------------------------------------------------------------------
1 | <@php
2 |
3 | namespace {namespace};
4 |
5 | use CodeIgniter\Filters\FilterInterface;
6 | use CodeIgniter\HTTP\RequestInterface;
7 | use CodeIgniter\HTTP\ResponseInterface;
8 |
9 | class {class} implements FilterInterface
10 | {
11 | /**
12 | * Do whatever processing this filter needs to do.
13 | * By default it should not return anything during
14 | * normal execution. However, when an abnormal state
15 | * is found, it should return an instance of
16 | * CodeIgniter\HTTP\Response. If it does, script
17 | * execution will end and that Response will be
18 | * sent back to the client, allowing for error pages,
19 | * redirects, etc.
20 | *
21 | * @param RequestInterface $request
22 | * @param array|null $arguments
23 | *
24 | * @return RequestInterface|ResponseInterface|string|void
25 | */
26 | public function before(RequestInterface $request, $arguments = null)
27 | {
28 | //
29 | }
30 |
31 | /**
32 | * Allows After filters to inspect and modify the response
33 | * object as needed. This method does not allow any way
34 | * to stop execution of other after filters, short of
35 | * throwing an Exception or Error.
36 | *
37 | * @param RequestInterface $request
38 | * @param ResponseInterface $response
39 | * @param array|null $arguments
40 | *
41 | * @return ResponseInterface|void
42 | */
43 | public function after(RequestInterface $request, ResponseInterface $response, $arguments = null)
44 | {
45 | //
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/system/Commands/Generators/Views/migration.tpl.php:
--------------------------------------------------------------------------------
1 | <@php
2 |
3 | namespace {namespace};
4 |
5 | use CodeIgniter\Database\Migration;
6 |
7 | class {class} extends Migration
8 | {
9 |
10 | protected $DBGroup = '= $DBGroup ?>';
11 |
12 | public function up()
13 | {
14 | $this->forge->addField([
15 | 'id' => ['type' => 'VARCHAR', 'constraint' => 128, 'null' => false],
16 |
17 | 'ip_address' => ['type' => 'VARCHAR', 'constraint' => 45, 'null' => false],
18 | 'timestamp timestamp DEFAULT CURRENT_TIMESTAMP NOT NULL',
19 | 'data' => ['type' => 'BLOB', 'null' => false],
20 |
21 | 'ip_address inet NOT NULL',
22 | 'timestamp timestamptz DEFAULT CURRENT_TIMESTAMP NOT NULL',
23 | "data bytea DEFAULT '' NOT NULL",
24 |
25 | ]);
26 |
27 | $this->forge->addKey(['id', 'ip_address'], true);
28 |
29 | $this->forge->addKey('id', true);
30 |
31 | $this->forge->addKey('timestamp');
32 | $this->forge->createTable('= $table ?>', true);
33 | }
34 |
35 | public function down()
36 | {
37 | $this->forge->dropTable('= $table ?>', true);
38 | }
39 |
40 | public function up()
41 | {
42 | //
43 | }
44 |
45 | public function down()
46 | {
47 | //
48 | }
49 |
50 | }
51 |
--------------------------------------------------------------------------------
/system/Commands/Generators/Views/model.tpl.php:
--------------------------------------------------------------------------------
1 | <@php
2 |
3 | namespace {namespace};
4 |
5 | use CodeIgniter\Model;
6 |
7 | class {class} extends Model
8 | {
9 |
10 | protected $DBGroup = '{dbGroup}';
11 |
12 | protected $table = '{table}';
13 | protected $primaryKey = 'id';
14 | protected $useAutoIncrement = true;
15 | protected $returnType = {return};
16 | protected $useSoftDeletes = false;
17 | protected $protectFields = true;
18 | protected $allowedFields = [];
19 |
20 | protected bool $allowEmptyInserts = false;
21 | protected bool $updateOnlyChanged = true;
22 |
23 | protected array $casts = [];
24 | protected array $castHandlers = [];
25 |
26 | // Dates
27 | protected $useTimestamps = false;
28 | protected $dateFormat = 'datetime';
29 | protected $createdField = 'created_at';
30 | protected $updatedField = 'updated_at';
31 | protected $deletedField = 'deleted_at';
32 |
33 | // Validation
34 | protected $validationRules = [];
35 | protected $validationMessages = [];
36 | protected $skipValidation = false;
37 | protected $cleanValidationRules = true;
38 |
39 | // Callbacks
40 | protected $allowCallbacks = true;
41 | protected $beforeInsert = [];
42 | protected $afterInsert = [];
43 | protected $beforeUpdate = [];
44 | protected $afterUpdate = [];
45 | protected $beforeFind = [];
46 | protected $afterFind = [];
47 | protected $beforeDelete = [];
48 | protected $afterDelete = [];
49 | }
50 |
--------------------------------------------------------------------------------
/system/Commands/Generators/Views/seeder.tpl.php:
--------------------------------------------------------------------------------
1 | <@php
2 |
3 | namespace {namespace};
4 |
5 | use CodeIgniter\Database\Seeder;
6 |
7 | class {class} extends Seeder
8 | {
9 | public function run()
10 | {
11 | //
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/system/Commands/Generators/Views/test.tpl.php:
--------------------------------------------------------------------------------
1 | <@php
2 |
3 | namespace {namespace};
4 |
5 | use CodeIgniter\Test\CIUnitTestCase;
6 |
7 | class {class} extends CIUnitTestCase
8 | {
9 | protected function setUp(): void
10 | {
11 | parent::setUp();
12 | }
13 |
14 | public function testExample(): void
15 | {
16 | //
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/system/Commands/Generators/Views/validation.tpl.php:
--------------------------------------------------------------------------------
1 | <@php
2 |
3 | namespace {namespace};
4 |
5 | class {class}
6 | {
7 | // public function custom_rule(): bool
8 | // {
9 | // return true;
10 | // }
11 | }
12 |
--------------------------------------------------------------------------------
/system/Config/Factory.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\Config;
15 |
16 | /**
17 | * Factories Configuration file.
18 | *
19 | * Provides overriding directives for how
20 | * Factories should handle discovery and
21 | * instantiation of specific components.
22 | * Each property should correspond to the
23 | * lowercase, plural component name.
24 | */
25 | class Factory extends BaseConfig
26 | {
27 | /**
28 | * Supplies a default set of options to merge for
29 | * all unspecified factory components.
30 | *
31 | * @var array
32 | */
33 | public static $default = [
34 | 'component' => null,
35 | 'path' => null,
36 | 'instanceOf' => null,
37 | 'getShared' => true,
38 | 'preferApp' => true,
39 | ];
40 |
41 | /**
42 | * Specifies that Models should always favor child
43 | * classes to allow easy extension of module Models.
44 | *
45 | * @var array
46 | */
47 | public $models = [
48 | 'preferApp' => true,
49 | ];
50 | }
51 |
--------------------------------------------------------------------------------
/system/Config/Publisher.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\Config;
15 |
16 | /**
17 | * Publisher Configuration
18 | *
19 | * Defines basic security restrictions for the Publisher class
20 | * to prevent abuse by injecting malicious files into a project.
21 | */
22 | class Publisher extends BaseConfig
23 | {
24 | /**
25 | * A list of allowed destinations with a (pseudo-)regex
26 | * of allowed files for each destination.
27 | * Attempts to publish to directories not in this list will
28 | * result in a PublisherException. Files that do no fit the
29 | * pattern will cause copy/merge to fail.
30 | *
31 | * @var array
32 | */
33 | public $restrictions = [
34 | ROOTPATH => '*',
35 | FCPATH => '#\.(?css|js|map|htm?|xml|json|webmanifest|tff|eot|woff?|gif|jpe?g|tiff?|png|webp|bmp|ico|svg)$#i',
36 | ];
37 |
38 | /**
39 | * Disables Registrars to prevent modules from altering the restrictions.
40 | */
41 | final protected function registerProperties(): void
42 | {
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/system/DataCaster/Cast/ArrayCast.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\DataCaster\Cast;
15 |
16 | /**
17 | * Class ArrayCast
18 | *
19 | * (PHP) [array --> string] --> (DB driver) --> (DB column) string
20 | * [ <-- string] <-- (DB driver) <-- (DB column) string
21 | */
22 | class ArrayCast extends BaseCast implements CastInterface
23 | {
24 | public static function get(
25 | mixed $value,
26 | array $params = [],
27 | ?object $helper = null,
28 | ): array {
29 | if (! is_string($value)) {
30 | self::invalidTypeValueError($value);
31 | }
32 |
33 | if ((str_starts_with($value, 'a:') || str_starts_with($value, 's:'))) {
34 | $value = unserialize($value, ['allowed_classes' => false]);
35 | }
36 |
37 | return (array) $value;
38 | }
39 |
40 | public static function set(
41 | mixed $value,
42 | array $params = [],
43 | ?object $helper = null,
44 | ): string {
45 | return serialize($value);
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/system/DataCaster/Cast/BaseCast.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\DataCaster\Cast;
15 |
16 | use CodeIgniter\Exceptions\InvalidArgumentException;
17 |
18 | abstract class BaseCast implements CastInterface
19 | {
20 | public static function get(
21 | mixed $value,
22 | array $params = [],
23 | ?object $helper = null,
24 | ): mixed {
25 | return $value;
26 | }
27 |
28 | public static function set(
29 | mixed $value,
30 | array $params = [],
31 | ?object $helper = null,
32 | ): mixed {
33 | return $value;
34 | }
35 |
36 | protected static function invalidTypeValueError(mixed $value): never
37 | {
38 | $message = '[' . static::class . '] Invalid value type: ' . get_debug_type($value);
39 | if (is_scalar($value)) {
40 | $message .= ', and its value: ' . var_export($value, true);
41 | }
42 |
43 | throw new InvalidArgumentException($message);
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/system/DataCaster/Cast/BooleanCast.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\DataCaster\Cast;
15 |
16 | /**
17 | * Class BooleanCast
18 | *
19 | * (PHP) [bool --> bool ] --> (DB driver) --> (DB column) bool|int(0/1)
20 | * [ <-- string|int] <-- (DB driver) <-- (DB column) bool|int(0/1)
21 | */
22 | class BooleanCast extends BaseCast
23 | {
24 | public static function get(
25 | mixed $value,
26 | array $params = [],
27 | ?object $helper = null,
28 | ): bool {
29 | // For PostgreSQL
30 | if ($value === 't') {
31 | return true;
32 | }
33 | if ($value === 'f') {
34 | return false;
35 | }
36 |
37 | return filter_var($value, FILTER_VALIDATE_BOOLEAN);
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/system/DataCaster/Cast/CSVCast.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\DataCaster\Cast;
15 |
16 | /**
17 | * Class CSVCast
18 | *
19 | * (PHP) [array --> string] --> (DB driver) --> (DB column) string
20 | * [ <-- string] <-- (DB driver) <-- (DB column) string
21 | */
22 | class CSVCast extends BaseCast
23 | {
24 | public static function get(
25 | mixed $value,
26 | array $params = [],
27 | ?object $helper = null,
28 | ): array {
29 | if (! is_string($value)) {
30 | self::invalidTypeValueError($value);
31 | }
32 |
33 | return explode(',', $value);
34 | }
35 |
36 | public static function set(
37 | mixed $value,
38 | array $params = [],
39 | ?object $helper = null,
40 | ): string {
41 | if (! is_array($value)) {
42 | self::invalidTypeValueError($value);
43 | }
44 |
45 | return implode(',', $value);
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/system/DataCaster/Cast/CastInterface.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\DataCaster\Cast;
15 |
16 | interface CastInterface
17 | {
18 | /**
19 | * Takes a value from DataSource, returns its value for PHP.
20 | *
21 | * @param mixed $value Data from database driver
22 | * @param list $params Additional param
23 | * @param object|null $helper Helper object. E.g., database connection
24 | *
25 | * @return mixed PHP native value
26 | */
27 | public static function get(
28 | mixed $value,
29 | array $params = [],
30 | ?object $helper = null,
31 | ): mixed;
32 |
33 | /**
34 | * Takes a PHP value, returns its value for DataSource.
35 | *
36 | * @param mixed $value PHP native value
37 | * @param list $params Additional param
38 | * @param object|null $helper Helper object. E.g., database connection
39 | *
40 | * @return mixed Data to pass to database driver
41 | */
42 | public static function set(
43 | mixed $value,
44 | array $params = [],
45 | ?object $helper = null,
46 | ): mixed;
47 | }
48 |
--------------------------------------------------------------------------------
/system/DataCaster/Cast/FloatCast.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\DataCaster\Cast;
15 |
16 | /**
17 | * Class FloatCast
18 | *
19 | * (PHP) [float --> float ] --> (DB driver) --> (DB column) float
20 | * [ <-- float|string] <-- (DB driver) <-- (DB column) float
21 | */
22 | class FloatCast extends BaseCast
23 | {
24 | public static function get(
25 | mixed $value,
26 | array $params = [],
27 | ?object $helper = null,
28 | ): float {
29 | if (! is_float($value) && ! is_string($value)) {
30 | self::invalidTypeValueError($value);
31 | }
32 |
33 | return (float) $value;
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/system/DataCaster/Cast/IntBoolCast.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\DataCaster\Cast;
15 |
16 | /**
17 | * Int Bool Cast
18 | *
19 | * (PHP) [bool --> int ] --> (DB driver) --> (DB column) int(0/1)
20 | * [ <-- int|string] <-- (DB driver) <-- (DB column) int(0/1)
21 | */
22 | final class IntBoolCast extends BaseCast
23 | {
24 | public static function get(
25 | mixed $value,
26 | array $params = [],
27 | ?object $helper = null,
28 | ): bool {
29 | if (! is_int($value) && ! is_string($value)) {
30 | self::invalidTypeValueError($value);
31 | }
32 |
33 | return (bool) $value;
34 | }
35 |
36 | public static function set(
37 | mixed $value,
38 | array $params = [],
39 | ?object $helper = null,
40 | ): int {
41 | if (! is_bool($value)) {
42 | self::invalidTypeValueError($value);
43 | }
44 |
45 | return (int) $value;
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/system/DataCaster/Cast/IntegerCast.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\DataCaster\Cast;
15 |
16 | /**
17 | * Class IntegerCast
18 | *
19 | * (PHP) [int --> int ] --> (DB driver) --> (DB column) int
20 | * [ <-- int|string] <-- (DB driver) <-- (DB column) int
21 | */
22 | class IntegerCast extends BaseCast
23 | {
24 | public static function get(
25 | mixed $value,
26 | array $params = [],
27 | ?object $helper = null,
28 | ): int {
29 | if (! is_string($value) && ! is_int($value)) {
30 | self::invalidTypeValueError($value);
31 | }
32 |
33 | return (int) $value;
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/system/DataCaster/Cast/TimestampCast.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\DataCaster\Cast;
15 |
16 | use CodeIgniter\I18n\Time;
17 |
18 | /**
19 | * Class TimestampCast
20 | *
21 | * (PHP) [Time --> int ] --> (DB driver) --> (DB column) int
22 | * [ <-- int|string] <-- (DB driver) <-- (DB column) int
23 | */
24 | class TimestampCast extends BaseCast
25 | {
26 | public static function get(
27 | mixed $value,
28 | array $params = [],
29 | ?object $helper = null,
30 | ): Time {
31 | if (! is_int($value) && ! is_string($value)) {
32 | self::invalidTypeValueError($value);
33 | }
34 |
35 | return Time::createFromTimestamp((int) $value, date_default_timezone_get());
36 | }
37 |
38 | public static function set(
39 | mixed $value,
40 | array $params = [],
41 | ?object $helper = null,
42 | ): int {
43 | if (! $value instanceof Time) {
44 | self::invalidTypeValueError($value);
45 | }
46 |
47 | return $value->getTimestamp();
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/system/DataCaster/Cast/URICast.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\DataCaster\Cast;
15 |
16 | use CodeIgniter\HTTP\URI;
17 |
18 | /**
19 | * Class URICast
20 | *
21 | * (PHP) [URI --> string] --> (DB driver) --> (DB column) string
22 | * [ <-- string] <-- (DB driver) <-- (DB column) string
23 | */
24 | class URICast extends BaseCast
25 | {
26 | public static function get(
27 | mixed $value,
28 | array $params = [],
29 | ?object $helper = null,
30 | ): URI {
31 | if (! is_string($value)) {
32 | self::invalidTypeValueError($value);
33 | }
34 |
35 | return new URI($value);
36 | }
37 |
38 | public static function set(
39 | mixed $value,
40 | array $params = [],
41 | ?object $helper = null,
42 | ): string {
43 | if (! $value instanceof URI) {
44 | self::invalidTypeValueError($value);
45 | }
46 |
47 | return (string) $value;
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/system/DataCaster/Exceptions/CastException.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\DataCaster\Exceptions;
15 |
16 | use CodeIgniter\Entity\Exceptions\CastException as EntityCastException;
17 |
18 | /**
19 | * CastException is thrown for invalid cast initialization and management.
20 | */
21 | class CastException extends EntityCastException
22 | {
23 | }
24 |
--------------------------------------------------------------------------------
/system/Database/Exceptions/DatabaseException.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\Database\Exceptions;
15 |
16 | use CodeIgniter\Exceptions\HasExitCodeInterface;
17 | use CodeIgniter\Exceptions\RuntimeException;
18 |
19 | class DatabaseException extends RuntimeException implements ExceptionInterface, HasExitCodeInterface
20 | {
21 | public function getExitCode(): int
22 | {
23 | return EXIT_DATABASE;
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/system/Database/Exceptions/ExceptionInterface.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\Database\Exceptions;
15 |
16 | /**
17 | * Provides a domain-level interface for broad capture
18 | * of all database-related exceptions.
19 | *
20 | * catch (\CodeIgniter\Database\Exceptions\ExceptionInterface) { ... }
21 | */
22 | interface ExceptionInterface extends \CodeIgniter\Exceptions\ExceptionInterface
23 | {
24 | }
25 |
--------------------------------------------------------------------------------
/system/Database/MySQLi/Utils.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\Database\MySQLi;
15 |
16 | use CodeIgniter\Database\BaseUtils;
17 | use CodeIgniter\Database\Exceptions\DatabaseException;
18 |
19 | /**
20 | * Utils for MySQLi
21 | */
22 | class Utils extends BaseUtils
23 | {
24 | /**
25 | * List databases statement
26 | *
27 | * @var string
28 | */
29 | protected $listDatabases = 'SHOW DATABASES';
30 |
31 | /**
32 | * OPTIMIZE TABLE statement
33 | *
34 | * @var string
35 | */
36 | protected $optimizeTable = 'OPTIMIZE TABLE %s';
37 |
38 | /**
39 | * Platform dependent version of the backup function.
40 | *
41 | * @return never
42 | */
43 | public function _backup(?array $prefs = null)
44 | {
45 | throw new DatabaseException('Unsupported feature of the database platform you are using.');
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/system/Database/OCI8/Utils.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\Database\OCI8;
15 |
16 | use CodeIgniter\Database\BaseUtils;
17 | use CodeIgniter\Database\Exceptions\DatabaseException;
18 |
19 | /**
20 | * Utils for OCI8
21 | */
22 | class Utils extends BaseUtils
23 | {
24 | /**
25 | * List databases statement
26 | *
27 | * @var string
28 | */
29 | protected $listDatabases = 'SELECT TABLESPACE_NAME FROM USER_TABLESPACES';
30 |
31 | /**
32 | * Platform dependent version of the backup function.
33 | *
34 | * @return never
35 | */
36 | public function _backup(?array $prefs = null)
37 | {
38 | throw new DatabaseException('Unsupported feature of the database platform you are using.');
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/system/Database/Postgre/Utils.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\Database\Postgre;
15 |
16 | use CodeIgniter\Database\BaseUtils;
17 | use CodeIgniter\Database\Exceptions\DatabaseException;
18 |
19 | /**
20 | * Utils for Postgre
21 | */
22 | class Utils extends BaseUtils
23 | {
24 | /**
25 | * List databases statement
26 | *
27 | * @var string
28 | */
29 | protected $listDatabases = 'SELECT datname FROM pg_database';
30 |
31 | /**
32 | * OPTIMIZE TABLE statement
33 | *
34 | * @var string
35 | */
36 | protected $optimizeTable = 'REINDEX TABLE %s';
37 |
38 | /**
39 | * Platform dependent version of the backup function.
40 | *
41 | * @return never
42 | */
43 | public function _backup(?array $prefs = null)
44 | {
45 | throw new DatabaseException('Unsupported feature of the database platform you are using.');
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/system/Database/RawSql.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\Database;
15 |
16 | use Stringable;
17 |
18 | /**
19 | * @see \CodeIgniter\Database\RawSqlTest
20 | */
21 | class RawSql implements Stringable
22 | {
23 | /**
24 | * @var string Raw SQL string
25 | */
26 | private string $string;
27 |
28 | public function __construct(string $sqlString)
29 | {
30 | $this->string = $sqlString;
31 | }
32 |
33 | public function __toString(): string
34 | {
35 | return $this->string;
36 | }
37 |
38 | /**
39 | * Create new instance with new SQL string
40 | */
41 | public function with(string $newSqlString): self
42 | {
43 | $new = clone $this;
44 | $new->string = $newSqlString;
45 |
46 | return $new;
47 | }
48 |
49 | /**
50 | * Returns unique id for binding key
51 | */
52 | public function getBindingKey(): string
53 | {
54 | return 'RawSql' . spl_object_id($this);
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/system/Database/SQLSRV/Utils.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\Database\SQLSRV;
15 |
16 | use CodeIgniter\Database\BaseUtils;
17 | use CodeIgniter\Database\ConnectionInterface;
18 | use CodeIgniter\Database\Exceptions\DatabaseException;
19 |
20 | /**
21 | * Utils for SQLSRV
22 | */
23 | class Utils extends BaseUtils
24 | {
25 | /**
26 | * List databases statement
27 | *
28 | * @var string
29 | */
30 | protected $listDatabases = 'EXEC sp_helpdb'; // Can also be: EXEC sp_databases
31 |
32 | /**
33 | * OPTIMIZE TABLE statement
34 | *
35 | * @var string
36 | */
37 | protected $optimizeTable = 'ALTER INDEX all ON %s REORGANIZE';
38 |
39 | public function __construct(ConnectionInterface $db)
40 | {
41 | parent::__construct($db);
42 |
43 | $this->optimizeTable = 'ALTER INDEX all ON ' . $this->db->schema . '.%s REORGANIZE';
44 | }
45 |
46 | /**
47 | * Platform dependent version of the backup function.
48 | *
49 | * @return never
50 | */
51 | public function _backup(?array $prefs = null)
52 | {
53 | throw new DatabaseException('Unsupported feature of the database platform you are using.');
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/system/Database/SQLite3/Utils.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\Database\SQLite3;
15 |
16 | use CodeIgniter\Database\BaseUtils;
17 | use CodeIgniter\Database\Exceptions\DatabaseException;
18 |
19 | /**
20 | * Utils for SQLite3
21 | */
22 | class Utils extends BaseUtils
23 | {
24 | /**
25 | * OPTIMIZE TABLE statement
26 | *
27 | * @var string
28 | */
29 | protected $optimizeTable = 'REINDEX %s';
30 |
31 | /**
32 | * Platform dependent version of the backup function.
33 | *
34 | * @return never
35 | */
36 | public function _backup(?array $prefs = null)
37 | {
38 | throw new DatabaseException('Unsupported feature of the database platform you are using.');
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/system/Debug/ExceptionHandlerInterface.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\Debug;
15 |
16 | use CodeIgniter\HTTP\RequestInterface;
17 | use CodeIgniter\HTTP\ResponseInterface;
18 | use Throwable;
19 |
20 | interface ExceptionHandlerInterface
21 | {
22 | /**
23 | * Determines the correct way to display the error.
24 | */
25 | public function handle(
26 | Throwable $exception,
27 | RequestInterface $request,
28 | ResponseInterface $response,
29 | int $statusCode,
30 | int $exitCode,
31 | ): void;
32 | }
33 |
--------------------------------------------------------------------------------
/system/Debug/Toolbar/Collectors/Config.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\Debug\Toolbar\Collectors;
15 |
16 | use CodeIgniter\CodeIgniter;
17 | use Config\App;
18 |
19 | /**
20 | * Debug toolbar configuration
21 | */
22 | class Config
23 | {
24 | /**
25 | * Return toolbar config values as an array.
26 | */
27 | public static function display(): array
28 | {
29 | $config = config(App::class);
30 |
31 | return [
32 | 'ciVersion' => CodeIgniter::CI_VERSION,
33 | 'phpVersion' => PHP_VERSION,
34 | 'phpSAPI' => PHP_SAPI,
35 | 'environment' => ENVIRONMENT,
36 | 'baseURL' => $config->baseURL,
37 | 'timezone' => app_timezone(),
38 | 'locale' => service('request')->getLocale(),
39 | 'cspEnabled' => $config->CSPEnabled,
40 | ];
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/system/Debug/Toolbar/Views/_config.tpl:
--------------------------------------------------------------------------------
1 |
2 | Read the CodeIgniter docs...
3 |
4 |
5 |
6 |
7 |
8 | CodeIgniter Version: |
9 | { ciVersion } |
10 |
11 |
12 | PHP Version: |
13 | { phpVersion } |
14 |
15 |
16 | PHP SAPI: |
17 | { phpSAPI } |
18 |
19 |
20 | Environment: |
21 | { environment } |
22 |
23 |
24 | Base URL: |
25 |
26 | { if $baseURL == '' }
27 |
28 | The $baseURL should always be set manually to prevent possible URL personification from external parties.
29 |
30 | { else }
31 | { baseURL }
32 | { endif }
33 | |
34 |
35 |
36 | Timezone: |
37 | { timezone } |
38 |
39 |
40 | Locale: |
41 | { locale } |
42 |
43 |
44 | Content Security Policy Enabled: |
45 | { if $cspEnabled } Yes { else } No { endif } |
46 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/system/Debug/Toolbar/Views/_database.tpl:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Time |
5 | Query String |
6 |
7 |
8 |
9 | {queries}
10 |
11 | {duration} |
12 | {! sql !} |
13 | {trace-file} |
14 |
15 |
16 | |
17 |
18 | {trace}
19 | {index}{file}
20 | {function}
21 | {/trace}
22 | |
23 |
24 | {/queries}
25 |
26 |
27 |
--------------------------------------------------------------------------------
/system/Debug/Toolbar/Views/_events.tpl:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Time |
5 | Event Name |
6 | Times Called |
7 |
8 |
9 |
10 | {events}
11 |
12 | { duration } ms |
13 | {event} |
14 | {count} |
15 |
16 | {/events}
17 |
18 |
19 |
--------------------------------------------------------------------------------
/system/Debug/Toolbar/Views/_files.tpl:
--------------------------------------------------------------------------------
1 |
2 |
3 | {userFiles}
4 |
5 | {name} |
6 | {path} |
7 |
8 | {/userFiles}
9 | {coreFiles}
10 |
11 | {name} |
12 | {path} |
13 |
14 | {/coreFiles}
15 |
16 |
17 |
--------------------------------------------------------------------------------
/system/Debug/Toolbar/Views/_history.tpl:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Action |
5 | Datetime |
6 | Status |
7 | Method |
8 | URL |
9 | Content-Type |
10 | Is AJAX? |
11 |
12 |
13 |
14 | {files}
15 |
16 |
17 |
18 | |
19 | {datetime} |
20 | {status} |
21 | {method} |
22 | {url} |
23 | {contentType} |
24 | {isAJAX} |
25 |
26 | {/files}
27 |
28 |
29 |
--------------------------------------------------------------------------------
/system/Debug/Toolbar/Views/_logs.tpl:
--------------------------------------------------------------------------------
1 | { if $logs == [] }
2 | Nothing was logged. If you were expecting logged items, ensure that LoggerConfig file has the correct threshold set.
3 | { else }
4 |
5 |
6 |
7 | Severity |
8 | Message |
9 |
10 |
11 |
12 | {logs}
13 |
14 | {level} |
15 | {msg} |
16 |
17 | {/logs}
18 |
19 |
20 | { endif }
21 |
--------------------------------------------------------------------------------
/system/Debug/Toolbar/Views/_routes.tpl:
--------------------------------------------------------------------------------
1 | Matched Route
2 |
3 |
4 |
5 | {matchedRoute}
6 |
7 | Directory: |
8 | {directory} |
9 |
10 |
11 | Controller: |
12 | {controller} |
13 |
14 |
15 | Method: |
16 | {method} |
17 |
18 |
19 | Params: |
20 | {paramCount} / {truePCount} |
21 |
22 | {params}
23 |
24 | {name} |
25 | {value} |
26 |
27 | {/params}
28 | {/matchedRoute}
29 |
30 |
31 |
32 |
33 | Defined Routes
34 |
35 |
36 |
37 |
38 | Method |
39 | Route |
40 | Handler |
41 |
42 |
43 |
44 | {routes}
45 |
46 | {method} |
47 | {route} |
48 | {handler} |
49 |
50 | {/routes}
51 |
52 |
53 |
--------------------------------------------------------------------------------
/system/Encryption/EncrypterInterface.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\Encryption;
15 |
16 | use CodeIgniter\Encryption\Exceptions\EncryptionException;
17 |
18 | /**
19 | * CodeIgniter Encryption Handler
20 | *
21 | * Provides two-way keyed encryption
22 | */
23 | interface EncrypterInterface
24 | {
25 | /**
26 | * Encrypt - convert plaintext into ciphertext
27 | *
28 | * @param string $data Input data
29 | * @param array|string|null $params Overridden parameters, specifically the key
30 | *
31 | * @return string
32 | *
33 | * @throws EncryptionException
34 | */
35 | public function encrypt($data, $params = null);
36 |
37 | /**
38 | * Decrypt - convert ciphertext into plaintext
39 | *
40 | * @param string $data Encrypted data
41 | * @param array|string|null $params Overridden parameters, specifically the key
42 | *
43 | * @return string
44 | *
45 | * @throws EncryptionException
46 | */
47 | public function decrypt($data, $params = null);
48 | }
49 |
--------------------------------------------------------------------------------
/system/Entity/Cast/ArrayCast.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\Entity\Cast;
15 |
16 | /**
17 | * Class ArrayCast
18 | */
19 | class ArrayCast extends BaseCast
20 | {
21 | /**
22 | * {@inheritDoc}
23 | */
24 | public static function get($value, array $params = []): array
25 | {
26 | if (is_string($value) && (str_starts_with($value, 'a:') || str_starts_with($value, 's:'))) {
27 | $value = unserialize($value);
28 | }
29 |
30 | return (array) $value;
31 | }
32 |
33 | /**
34 | * {@inheritDoc}
35 | */
36 | public static function set($value, array $params = []): string
37 | {
38 | return serialize($value);
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/system/Entity/Cast/BaseCast.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\Entity\Cast;
15 |
16 | /**
17 | * Class BaseCast
18 | */
19 | abstract class BaseCast implements CastInterface
20 | {
21 | /**
22 | * Get
23 | *
24 | * @param array|bool|float|int|object|string|null $value Data
25 | * @param array $params Additional param
26 | *
27 | * @return array|bool|float|int|object|string|null
28 | */
29 | public static function get($value, array $params = [])
30 | {
31 | return $value;
32 | }
33 |
34 | /**
35 | * Set
36 | *
37 | * @param array|bool|float|int|object|string|null $value Data
38 | * @param array $params Additional param
39 | *
40 | * @return array|bool|float|int|object|string|null
41 | */
42 | public static function set($value, array $params = [])
43 | {
44 | return $value;
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/system/Entity/Cast/BooleanCast.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\Entity\Cast;
15 |
16 | /**
17 | * Class BooleanCast
18 | */
19 | class BooleanCast extends BaseCast
20 | {
21 | /**
22 | * {@inheritDoc}
23 | */
24 | public static function get($value, array $params = []): bool
25 | {
26 | return (bool) $value;
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/system/Entity/Cast/CSVCast.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\Entity\Cast;
15 |
16 | /**
17 | * Class CSVCast
18 | */
19 | class CSVCast extends BaseCast
20 | {
21 | /**
22 | * {@inheritDoc}
23 | */
24 | public static function get($value, array $params = []): array
25 | {
26 | return explode(',', $value);
27 | }
28 |
29 | /**
30 | * {@inheritDoc}
31 | */
32 | public static function set($value, array $params = []): string
33 | {
34 | return implode(',', $value);
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/system/Entity/Cast/CastInterface.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\Entity\Cast;
15 |
16 | /**
17 | * Interface CastInterface
18 | *
19 | * The methods work at (1)(4) only.
20 | * [App Code] --- (1) --> [Entity] --- (2) --> [Database]
21 | * [App Code] <-- (4) --- [Entity] <-- (3) --- [Database]
22 | */
23 | interface CastInterface
24 | {
25 | /**
26 | * Takes a raw value from Entity, returns its value for PHP.
27 | *
28 | * @param array|bool|float|int|object|string|null $value Data
29 | * @param array $params Additional param
30 | *
31 | * @return array|bool|float|int|object|string|null
32 | */
33 | public static function get($value, array $params = []);
34 |
35 | /**
36 | * Takes a PHP value, returns its raw value for Entity.
37 | *
38 | * @param array|bool|float|int|object|string|null $value Data
39 | * @param array $params Additional param
40 | *
41 | * @return array|bool|float|int|object|string|null
42 | */
43 | public static function set($value, array $params = []);
44 | }
45 |
--------------------------------------------------------------------------------
/system/Entity/Cast/DatetimeCast.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\Entity\Cast;
15 |
16 | use CodeIgniter\I18n\Time;
17 | use DateTime;
18 | use Exception;
19 |
20 | /**
21 | * Class DatetimeCast
22 | */
23 | class DatetimeCast extends BaseCast
24 | {
25 | /**
26 | * {@inheritDoc}
27 | *
28 | * @return Time
29 | *
30 | * @throws Exception
31 | */
32 | public static function get($value, array $params = [])
33 | {
34 | if ($value instanceof Time) {
35 | return $value;
36 | }
37 |
38 | if ($value instanceof DateTime) {
39 | return Time::createFromInstance($value);
40 | }
41 |
42 | if (is_numeric($value)) {
43 | return Time::createFromTimestamp((int) $value, date_default_timezone_get());
44 | }
45 |
46 | if (is_string($value)) {
47 | return Time::parse($value);
48 | }
49 |
50 | return $value;
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/system/Entity/Cast/FloatCast.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\Entity\Cast;
15 |
16 | /**
17 | * Class FloatCast
18 | */
19 | class FloatCast extends BaseCast
20 | {
21 | /**
22 | * {@inheritDoc}
23 | */
24 | public static function get($value, array $params = []): float
25 | {
26 | return (float) $value;
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/system/Entity/Cast/IntBoolCast.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\Entity\Cast;
15 |
16 | /**
17 | * Int Bool Cast
18 | *
19 | * DB column: int (0/1) <--> Class property: bool
20 | */
21 | final class IntBoolCast extends BaseCast
22 | {
23 | /**
24 | * @param int $value
25 | */
26 | public static function get($value, array $params = []): bool
27 | {
28 | return (bool) $value;
29 | }
30 |
31 | /**
32 | * @param bool|int|string $value
33 | */
34 | public static function set($value, array $params = []): int
35 | {
36 | return (int) $value;
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/system/Entity/Cast/IntegerCast.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\Entity\Cast;
15 |
16 | /**
17 | * Class IntegerCast
18 | */
19 | class IntegerCast extends BaseCast
20 | {
21 | /**
22 | * {@inheritDoc}
23 | */
24 | public static function get($value, array $params = []): int
25 | {
26 | return (int) $value;
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/system/Entity/Cast/ObjectCast.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\Entity\Cast;
15 |
16 | /**
17 | * Class ObjectCast
18 | */
19 | class ObjectCast extends BaseCast
20 | {
21 | /**
22 | * {@inheritDoc}
23 | */
24 | public static function get($value, array $params = []): object
25 | {
26 | return (object) $value;
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/system/Entity/Cast/StringCast.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\Entity\Cast;
15 |
16 | /**
17 | * Class StringCast
18 | */
19 | class StringCast extends BaseCast
20 | {
21 | /**
22 | * {@inheritDoc}
23 | */
24 | public static function get($value, array $params = []): string
25 | {
26 | return (string) $value;
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/system/Entity/Cast/TimestampCast.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\Entity\Cast;
15 |
16 | use CodeIgniter\Entity\Exceptions\CastException;
17 |
18 | /**
19 | * Class TimestampCast
20 | */
21 | class TimestampCast extends BaseCast
22 | {
23 | /**
24 | * {@inheritDoc}
25 | */
26 | public static function get($value, array $params = [])
27 | {
28 | $value = strtotime($value);
29 |
30 | if ($value === false) {
31 | throw CastException::forInvalidTimestamp();
32 | }
33 |
34 | return $value;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/system/Entity/Cast/URICast.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\Entity\Cast;
15 |
16 | use CodeIgniter\HTTP\URI;
17 |
18 | /**
19 | * Class URICast
20 | */
21 | class URICast extends BaseCast
22 | {
23 | /**
24 | * {@inheritDoc}
25 | */
26 | public static function get($value, array $params = []): URI
27 | {
28 | return $value instanceof URI ? $value : new URI($value);
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/system/Exceptions/BadFunctionCallException.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\Exceptions;
15 |
16 | /**
17 | * Exception thrown if a function is called in the wrong way, or the function
18 | * does not exist.
19 | */
20 | class BadFunctionCallException extends \BadFunctionCallException implements ExceptionInterface
21 | {
22 | }
23 |
--------------------------------------------------------------------------------
/system/Exceptions/BadMethodCallException.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\Exceptions;
15 |
16 | /**
17 | * Exception thrown if a method is called in the wrong way, or the method
18 | * does not exist.
19 | */
20 | class BadMethodCallException extends \BadMethodCallException implements ExceptionInterface
21 | {
22 | }
23 |
--------------------------------------------------------------------------------
/system/Exceptions/ConfigException.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\Exceptions;
15 |
16 | /**
17 | * Exception thrown if the value of the Config class is invalid or the type is
18 | * incorrect.
19 | */
20 | class ConfigException extends RuntimeException implements HasExitCodeInterface
21 | {
22 | use DebugTraceableTrait;
23 |
24 | public function getExitCode(): int
25 | {
26 | return EXIT_CONFIG;
27 | }
28 |
29 | /**
30 | * @return static
31 | */
32 | public static function forDisabledMigrations()
33 | {
34 | return new static(lang('Migrations.disabled'));
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/system/Exceptions/CriticalError.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\Exceptions;
15 |
16 | /**
17 | * Error: Critical conditions, like component unavailable, etc.
18 | */
19 | class CriticalError extends RuntimeException
20 | {
21 | }
22 |
--------------------------------------------------------------------------------
/system/Exceptions/DebugTraceableTrait.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\Exceptions;
15 |
16 | use Throwable;
17 |
18 | /**
19 | * This trait provides framework exceptions the ability to pinpoint
20 | * accurately where the exception was raised rather than instantiated.
21 | *
22 | * This is used primarily for factory-instantiated exceptions.
23 | */
24 | trait DebugTraceableTrait
25 | {
26 | /**
27 | * Tweaks the exception's constructor to assign the file/line to where
28 | * it is actually raised rather than were it is instantiated.
29 | */
30 | final public function __construct(string $message = '', int $code = 0, ?Throwable $previous = null)
31 | {
32 | parent::__construct($message, $code, $previous);
33 |
34 | $trace = $this->getTrace()[0];
35 |
36 | if (isset($trace['class']) && $trace['class'] === static::class) {
37 | [
38 | 'line' => $this->line,
39 | 'file' => $this->file,
40 | ] = $trace;
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/system/Exceptions/DownloadException.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\Exceptions;
15 |
16 | /**
17 | * Class DownloadException
18 | */
19 | class DownloadException extends RuntimeException
20 | {
21 | use DebugTraceableTrait;
22 |
23 | /**
24 | * @return static
25 | */
26 | public static function forCannotSetFilePath(string $path)
27 | {
28 | return new static(lang('HTTP.cannotSetFilepath', [$path]));
29 | }
30 |
31 | /**
32 | * @return static
33 | */
34 | public static function forCannotSetBinary()
35 | {
36 | return new static(lang('HTTP.cannotSetBinary'));
37 | }
38 |
39 | /**
40 | * @return static
41 | */
42 | public static function forNotFoundDownloadSource()
43 | {
44 | return new static(lang('HTTP.notFoundDownloadSource'));
45 | }
46 |
47 | /**
48 | * @deprecated Since v4.5.6
49 | *
50 | * @return static
51 | */
52 | public static function forCannotSetCache()
53 | {
54 | return new static(lang('HTTP.cannotSetCache'));
55 | }
56 |
57 | /**
58 | * @return static
59 | */
60 | public static function forCannotSetStatusCode(int $code, string $reason)
61 | {
62 | return new static(lang('HTTP.cannotSetStatusCode', [$code, $reason]));
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/system/Exceptions/ExceptionInterface.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\Exceptions;
15 |
16 | /**
17 | * Provides a domain-level interface for broad capture
18 | * of all framework-related exceptions.
19 | *
20 | * catch (\CodeIgniter\Exceptions\ExceptionInterface) { ... }
21 | */
22 | interface ExceptionInterface
23 | {
24 | }
25 |
--------------------------------------------------------------------------------
/system/Exceptions/HTTPExceptionInterface.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\Exceptions;
15 |
16 | /**
17 | * Interface for Exceptions that has exception code as HTTP status code.
18 | */
19 | interface HTTPExceptionInterface extends ExceptionInterface
20 | {
21 | }
22 |
--------------------------------------------------------------------------------
/system/Exceptions/HasExitCodeInterface.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\Exceptions;
15 |
16 | /**
17 | * Interface for Exceptions that has exception code as exit code.
18 | */
19 | interface HasExitCodeInterface extends ExceptionInterface
20 | {
21 | /**
22 | * Returns exit status code.
23 | */
24 | public function getExitCode(): int;
25 | }
26 |
--------------------------------------------------------------------------------
/system/Exceptions/InvalidArgumentException.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\Exceptions;
15 |
16 | /**
17 | * Exception thrown if an argument is not of the expected type.
18 | */
19 | class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
20 | {
21 | }
22 |
--------------------------------------------------------------------------------
/system/Exceptions/LogicException.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\Exceptions;
15 |
16 | /**
17 | * Exception that represents error in the program logic.
18 | */
19 | class LogicException extends \LogicException implements ExceptionInterface
20 | {
21 | }
22 |
--------------------------------------------------------------------------------
/system/Exceptions/ModelException.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\Exceptions;
15 |
16 | /**
17 | * Model Exceptions.
18 | */
19 | class ModelException extends FrameworkException
20 | {
21 | /**
22 | * @return static
23 | */
24 | public static function forNoPrimaryKey(string $modelName)
25 | {
26 | return new static(lang('Database.noPrimaryKey', [$modelName]));
27 | }
28 |
29 | /**
30 | * @return static
31 | */
32 | public static function forNoDateFormat(string $modelName)
33 | {
34 | return new static(lang('Database.noDateFormat', [$modelName]));
35 | }
36 |
37 | /**
38 | * @return static
39 | */
40 | public static function forMethodNotAvailable(string $modelName, string $methodName)
41 | {
42 | return new static(lang('Database.methodNotAvailable', [$modelName, $methodName]));
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/system/Exceptions/RuntimeException.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\Exceptions;
15 |
16 | /**
17 | * Exception thrown if an error which can only be found on runtime occurs.
18 | */
19 | class RuntimeException extends \RuntimeException implements ExceptionInterface
20 | {
21 | }
22 |
--------------------------------------------------------------------------------
/system/Exceptions/TestException.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\Exceptions;
15 |
16 | /**
17 | * Exception thrown when there is an error with the test code.
18 | */
19 | class TestException extends LogicException
20 | {
21 | use DebugTraceableTrait;
22 |
23 | /**
24 | * @return static
25 | */
26 | public static function forInvalidMockClass(string $name)
27 | {
28 | return new static(lang('Test.invalidMockClass', [$name]));
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/system/Files/Exceptions/ExceptionInterface.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\Files\Exceptions;
15 |
16 | /**
17 | * Provides a domain-level interface for broad capture
18 | * of all Files-related exceptions.
19 | *
20 | * catch (\CodeIgniter\Files\Exceptions\ExceptionInterface) { ... }
21 | */
22 | interface ExceptionInterface extends \CodeIgniter\Exceptions\ExceptionInterface
23 | {
24 | }
25 |
--------------------------------------------------------------------------------
/system/Files/Exceptions/FileException.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\Files\Exceptions;
15 |
16 | use CodeIgniter\Exceptions\DebugTraceableTrait;
17 | use CodeIgniter\Exceptions\RuntimeException;
18 |
19 | class FileException extends RuntimeException implements ExceptionInterface
20 | {
21 | use DebugTraceableTrait;
22 |
23 | /**
24 | * @return static
25 | */
26 | public static function forUnableToMove(?string $from = null, ?string $to = null, ?string $error = null)
27 | {
28 | return new static(lang('Files.cannotMove', [$from, $to, $error]));
29 | }
30 |
31 | /**
32 | * Throws when an item is expected to be a directory but is not or is missing.
33 | *
34 | * @param string $caller The method causing the exception
35 | *
36 | * @return static
37 | */
38 | public static function forExpectedDirectory(string $caller)
39 | {
40 | return new static(lang('Files.expectedDirectory', [$caller]));
41 | }
42 |
43 | /**
44 | * Throws when an item is expected to be a file but is not or is missing.
45 | *
46 | * @param string $caller The method causing the exception
47 | *
48 | * @return static
49 | */
50 | public static function forExpectedFile(string $caller)
51 | {
52 | return new static(lang('Files.expectedFile', [$caller]));
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/system/Files/Exceptions/FileNotFoundException.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\Files\Exceptions;
15 |
16 | use CodeIgniter\Exceptions\DebugTraceableTrait;
17 | use CodeIgniter\Exceptions\RuntimeException;
18 |
19 | class FileNotFoundException extends RuntimeException implements ExceptionInterface
20 | {
21 | use DebugTraceableTrait;
22 |
23 | /**
24 | * @return static
25 | */
26 | public static function forFileNotFound(string $path)
27 | {
28 | return new static(lang('Files.fileNotFound', [$path]));
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/system/Files/FileSizeUnit.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\Files;
15 |
16 | use CodeIgniter\Exceptions\InvalidArgumentException;
17 |
18 | enum FileSizeUnit: int
19 | {
20 | case B = 0;
21 | case KB = 1;
22 | case MB = 2;
23 | case GB = 3;
24 | case TB = 4;
25 |
26 | /**
27 | * Allows the creation of a FileSizeUnit from Strings like "kb" or "mb"
28 | *
29 | * @throws InvalidArgumentException
30 | */
31 | public static function fromString(string $unit): self
32 | {
33 | return match (strtolower($unit)) {
34 | 'b' => self::B,
35 | 'kb' => self::KB,
36 | 'mb' => self::MB,
37 | 'gb' => self::GB,
38 | 'tb' => self::TB,
39 | default => throw new InvalidArgumentException("Invalid unit: {$unit}"),
40 | };
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/system/Filters/DebugToolbar.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\Filters;
15 |
16 | use CodeIgniter\HTTP\RequestInterface;
17 | use CodeIgniter\HTTP\ResponseInterface;
18 |
19 | /**
20 | * Debug toolbar filter
21 | *
22 | * @see \CodeIgniter\Filters\DebugToolbarTest
23 | */
24 | class DebugToolbar implements FilterInterface
25 | {
26 | /**
27 | * We don't need to do anything here.
28 | *
29 | * @param list|null $arguments
30 | */
31 | public function before(RequestInterface $request, $arguments = null)
32 | {
33 | return null;
34 | }
35 |
36 | /**
37 | * If the debug flag is set (CI_DEBUG) then collect performance
38 | * and debug information and display it in a toolbar.
39 | *
40 | * @param list|null $arguments
41 | */
42 | public function after(RequestInterface $request, ResponseInterface $response, $arguments = null)
43 | {
44 | service('toolbar')->prepare($request, $response);
45 |
46 | return null;
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/system/Filters/Exceptions/FilterException.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\Filters\Exceptions;
15 |
16 | use CodeIgniter\Exceptions\ConfigException;
17 |
18 | /**
19 | * FilterException
20 | */
21 | class FilterException extends ConfigException
22 | {
23 | /**
24 | * Thrown when the provided alias is not within
25 | * the list of configured filter aliases.
26 | *
27 | * @return static
28 | */
29 | public static function forNoAlias(string $alias)
30 | {
31 | return new static(lang('Filters.noFilter', [$alias]));
32 | }
33 |
34 | /**
35 | * Thrown when the filter class does not implement FilterInterface.
36 | *
37 | * @return static
38 | */
39 | public static function forIncorrectInterface(string $class)
40 | {
41 | return new static(lang('Filters.incorrectInterface', [$class]));
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/system/Filters/Honeypot.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\Filters;
15 |
16 | use CodeIgniter\Honeypot\Exceptions\HoneypotException;
17 | use CodeIgniter\HTTP\IncomingRequest;
18 | use CodeIgniter\HTTP\RequestInterface;
19 | use CodeIgniter\HTTP\ResponseInterface;
20 |
21 | /**
22 | * Honeypot filter
23 | *
24 | * @see \CodeIgniter\Filters\HoneypotTest
25 | */
26 | class Honeypot implements FilterInterface
27 | {
28 | /**
29 | * Checks if Honeypot field is empty, if not then the
30 | * requester is a bot
31 | *
32 | * @param list|null $arguments
33 | *
34 | * @throws HoneypotException
35 | */
36 | public function before(RequestInterface $request, $arguments = null)
37 | {
38 | if (! $request instanceof IncomingRequest) {
39 | return null;
40 | }
41 |
42 | if (service('honeypot')->hasContent($request)) {
43 | throw HoneypotException::isBot();
44 | }
45 |
46 | return null;
47 | }
48 |
49 | /**
50 | * Attach a honeypot to the current response.
51 | *
52 | * @param list|null $arguments
53 | */
54 | public function after(RequestInterface $request, ResponseInterface $response, $arguments = null)
55 | {
56 | service('honeypot')->attachHoneypot($response);
57 |
58 | return null;
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/system/Format/FormatterInterface.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\Format;
15 |
16 | /**
17 | * Formatter interface
18 | */
19 | interface FormatterInterface
20 | {
21 | /**
22 | * Takes the given data and formats it.
23 | *
24 | * @param array|object|string $data
25 | *
26 | * @return false|string
27 | */
28 | public function format($data);
29 | }
30 |
--------------------------------------------------------------------------------
/system/Format/JSONFormatter.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\Format;
15 |
16 | use CodeIgniter\Format\Exceptions\FormatException;
17 | use Config\Format;
18 |
19 | /**
20 | * JSON data formatter
21 | *
22 | * @see \CodeIgniter\Format\JSONFormatterTest
23 | */
24 | class JSONFormatter implements FormatterInterface
25 | {
26 | /**
27 | * Takes the given data and formats it.
28 | *
29 | * @param array|bool|float|int|object|string|null $data
30 | *
31 | * @return false|string (JSON string | false)
32 | */
33 | public function format($data)
34 | {
35 | $config = new Format();
36 |
37 | $options = $config->formatterOptions['application/json'] ?? JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES;
38 | $options |= JSON_PARTIAL_OUTPUT_ON_ERROR;
39 |
40 | $options = ENVIRONMENT === 'production' ? $options : $options | JSON_PRETTY_PRINT;
41 |
42 | $result = json_encode($data, $options, 512);
43 |
44 | if (! in_array(json_last_error(), [JSON_ERROR_NONE, JSON_ERROR_RECURSION], true)) {
45 | throw FormatException::forInvalidJSON(json_last_error_msg());
46 | }
47 |
48 | return $result;
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/system/HTTP/Exceptions/BadRequestException.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\HTTP\Exceptions;
15 |
16 | use CodeIgniter\Exceptions\HTTPExceptionInterface;
17 | use CodeIgniter\Exceptions\RuntimeException;
18 |
19 | /**
20 | * 400 Bad Request
21 | */
22 | class BadRequestException extends RuntimeException implements HTTPExceptionInterface
23 | {
24 | /**
25 | * HTTP status code for Bad Request
26 | *
27 | * @var int
28 | */
29 | protected $code = 400; // @phpstan-ignore-line
30 | }
31 |
--------------------------------------------------------------------------------
/system/HTTP/Exceptions/ExceptionInterface.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\HTTP\Exceptions;
15 |
16 | /**
17 | * Provides a domain-level interface for broad capture
18 | * of all HTTP-related exceptions.
19 | *
20 | * catch (\CodeIgniter\HTTP\Exceptions\ExceptionInterface) { ... }
21 | */
22 | interface ExceptionInterface extends \CodeIgniter\Exceptions\ExceptionInterface
23 | {
24 | }
25 |
--------------------------------------------------------------------------------
/system/HTTP/RequestInterface.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\HTTP;
15 |
16 | /**
17 | * Representation of an incoming, server-side HTTP request.
18 | *
19 | * Corresponds to Psr7\ServerRequestInterface.
20 | */
21 | interface RequestInterface extends OutgoingRequestInterface
22 | {
23 | /**
24 | * Gets the user's IP address.
25 | * Supplied by RequestTrait.
26 | *
27 | * @return string IP address
28 | */
29 | public function getIPAddress(): string;
30 |
31 | /**
32 | * Fetch an item from the $_SERVER array.
33 | * Supplied by RequestTrait.
34 | *
35 | * @param array|string|null $index Index for item to be fetched from $_SERVER
36 | * @param int|null $filter A filter name to be applied
37 | *
38 | * @return mixed
39 | */
40 | public function getServer($index = null, $filter = null);
41 | }
42 |
--------------------------------------------------------------------------------
/system/HTTP/ResponsableInterface.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\HTTP;
15 |
16 | interface ResponsableInterface
17 | {
18 | public function getResponse(): ResponseInterface;
19 | }
20 |
--------------------------------------------------------------------------------
/system/Helpers/security_helper.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | // CodeIgniter Security Helpers
15 |
16 | if (! function_exists('sanitize_filename')) {
17 | /**
18 | * Sanitize a filename to use in a URI.
19 | */
20 | function sanitize_filename(string $filename): string
21 | {
22 | return service('security')->sanitizeFilename($filename);
23 | }
24 | }
25 |
26 | if (! function_exists('strip_image_tags')) {
27 | /**
28 | * Strip Image Tags
29 | */
30 | function strip_image_tags(string $str): string
31 | {
32 | return preg_replace(
33 | [
34 | '#
#i',
35 | '#
`]+)).*?\>#i',
36 | ],
37 | '\\2',
38 | $str,
39 | );
40 | }
41 | }
42 |
43 | if (! function_exists('encode_php_tags')) {
44 | /**
45 | * Convert PHP tags to entities
46 | */
47 | function encode_php_tags(string $str): string
48 | {
49 | return str_replace(['', '?>'], ['<?', '?>'], $str);
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/system/Honeypot/Exceptions/HoneypotException.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\Honeypot\Exceptions;
15 |
16 | use CodeIgniter\Exceptions\ConfigException;
17 |
18 | class HoneypotException extends ConfigException
19 | {
20 | /**
21 | * Thrown when the template value of config is empty.
22 | *
23 | * @return static
24 | */
25 | public static function forNoTemplate()
26 | {
27 | return new static(lang('Honeypot.noTemplate'));
28 | }
29 |
30 | /**
31 | * Thrown when the name value of config is empty.
32 | *
33 | * @return static
34 | */
35 | public static function forNoNameField()
36 | {
37 | return new static(lang('Honeypot.noNameField'));
38 | }
39 |
40 | /**
41 | * Thrown when the hidden value of config is false.
42 | *
43 | * @return static
44 | */
45 | public static function forNoHiddenValue()
46 | {
47 | return new static(lang('Honeypot.noHiddenValue'));
48 | }
49 |
50 | /**
51 | * Thrown when there are no data in the request of honeypot field.
52 | *
53 | * @return static
54 | */
55 | public static function isBot()
56 | {
57 | return new static(lang('Honeypot.theClientIsABot'));
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/system/HotReloader/IteratorFilter.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\HotReloader;
15 |
16 | use Config\Toolbar;
17 | use RecursiveFilterIterator;
18 | use RecursiveIterator;
19 |
20 | /**
21 | * @internal
22 | *
23 | * @psalm-suppress MissingTemplateParam
24 | */
25 | final class IteratorFilter extends RecursiveFilterIterator implements RecursiveIterator
26 | {
27 | private array $watchedExtensions = [];
28 |
29 | public function __construct(RecursiveIterator $iterator)
30 | {
31 | parent::__construct($iterator);
32 |
33 | $this->watchedExtensions = config(Toolbar::class)->watchedExtensions;
34 | }
35 |
36 | /**
37 | * Apply filters to the files in the iterator.
38 | */
39 | public function accept(): bool
40 | {
41 | if (! $this->current()->isFile()) {
42 | return true;
43 | }
44 |
45 | $filename = $this->current()->getFilename();
46 |
47 | // Skip hidden files and directories.
48 | if ($filename[0] === '.') {
49 | return false;
50 | }
51 |
52 | // Only consume files of interest.
53 | $ext = trim(strtolower($this->current()->getExtension()), '. ');
54 |
55 | return in_array($ext, $this->watchedExtensions, true);
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/system/I18n/Time.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\I18n;
15 |
16 | use DateTimeImmutable;
17 | use Stringable;
18 |
19 | /**
20 | * A localized date/time package inspired
21 | * by Nesbot/Carbon and CakePHP/Chronos.
22 | *
23 | * Requires the intl PHP extension.
24 | *
25 | * @property-read int $age
26 | * @property-read string $day
27 | * @property-read string $dayOfWeek
28 | * @property-read string $dayOfYear
29 | * @property-read bool $dst
30 | * @property-read string $hour
31 | * @property-read bool $local
32 | * @property-read string $minute
33 | * @property-read string $month
34 | * @property-read string $quarter
35 | * @property-read string $second
36 | * @property-read int $timestamp
37 | * @property-read bool $utc
38 | * @property-read string $weekOfMonth
39 | * @property-read string $weekOfYear
40 | * @property-read string $year
41 | *
42 | * @phpstan-consistent-constructor
43 | *
44 | * @see \CodeIgniter\I18n\TimeTest
45 | */
46 | class Time extends DateTimeImmutable implements Stringable
47 | {
48 | use TimeTrait;
49 | }
50 |
--------------------------------------------------------------------------------
/system/Language/en/Cache.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | // Cache language settings
15 | return [
16 | 'unableToWrite' => 'Cache unable to write to "{0}".',
17 | 'invalidHandlers' => 'Cache config must have an array of $validHandlers.',
18 | 'noBackup' => 'Cache config must have a handler and backupHandler set.',
19 | 'handlerNotFound' => 'Cache config has an invalid handler or backup handler specified.',
20 | ];
21 |
--------------------------------------------------------------------------------
/system/Language/en/Cast.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | // Cast language settings
15 | return [
16 | 'baseCastMissing' => 'The "{0}" class must inherit the "CodeIgniter\Entity\Cast\BaseCast" class.',
17 | 'invalidCastMethod' => 'The "{0}" is invalid cast method, valid methods are: ["get", "set"].',
18 | 'invalidTimestamp' => 'Type casting "timestamp" expects a correct timestamp.',
19 | 'jsonErrorCtrlChar' => 'Unexpected control character found.',
20 | 'jsonErrorDepth' => 'Maximum stack depth exceeded.',
21 | 'jsonErrorStateMismatch' => 'Underflow or the modes mismatch.',
22 | 'jsonErrorSyntax' => 'Syntax error, malformed JSON.',
23 | 'jsonErrorUnknown' => 'Unknown error.',
24 | 'jsonErrorUtf8' => 'Malformed UTF-8 characters, possibly incorrectly encoded.',
25 | ];
26 |
--------------------------------------------------------------------------------
/system/Language/en/Cookie.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | // Cookie language settings
15 | return [
16 | 'invalidExpiresTime' => 'Invalid "{0}" type for "Expires" attribute. Expected: string, integer, DateTimeInterface object.',
17 | 'invalidExpiresValue' => 'The cookie expiration time is not valid.',
18 | 'invalidCookieName' => 'The cookie name "{0}" contains invalid characters.',
19 | 'emptyCookieName' => 'The cookie name cannot be empty.',
20 | 'invalidSecurePrefix' => 'Using the "__Secure-" prefix requires setting the "Secure" attribute.',
21 | 'invalidHostPrefix' => 'Using the "__Host-" prefix must be set with the "Secure" flag, must not have a "Domain" attribute, and the "Path" is set to "/".',
22 | 'invalidSameSite' => 'The SameSite value must be None, Lax, Strict or a blank string, {0} given.',
23 | 'invalidSameSiteNone' => 'Using the "SameSite=None" attribute requires setting the "Secure" attribute.',
24 | 'invalidCookieInstance' => '"{0}" class expected cookies array to be instances of "{1}" but got "{2}" at index {3}.',
25 | 'unknownCookieInstance' => 'Cookie object with name "{0}" and prefix "{1}" was not found in the collection.',
26 | ];
27 |
--------------------------------------------------------------------------------
/system/Language/en/Core.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | // Core language settings
15 | return [
16 | 'copyError' => 'An error was encountered while attempting to replace the file "{0}". Please make sure your file directory is writable.',
17 | 'enabledZlibOutputCompression' => 'Your zlib.output_compression ini directive is turned on. This will not work well with output buffers.',
18 | 'invalidFile' => 'Invalid file: "{0}"',
19 | 'invalidDirectory' => 'Directory does not exist: "{0}"',
20 | 'invalidPhpVersion' => 'Your PHP version must be {0} or higher to run CodeIgniter. Current version: {1}',
21 | 'missingExtension' => 'The framework needs the following extension(s) installed and loaded: "{0}".',
22 | 'noHandlers' => '"{0}" must provide at least one Handler.',
23 | ];
24 |
--------------------------------------------------------------------------------
/system/Language/en/Encryption.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | // Encryption language settings
15 | return [
16 | 'noDriverRequested' => 'No driver requested; Miss Daisy will be so upset!',
17 | 'noHandlerAvailable' => 'Unable to find an available "{0}" encryption handler.',
18 | 'unKnownHandler' => '"{0}" cannot be configured.',
19 | 'starterKeyNeeded' => 'Encrypter needs a starter key.',
20 | 'authenticationFailed' => 'Decrypting: authentication failed.',
21 | 'encryptionFailed' => 'Encryption failed.',
22 | ];
23 |
--------------------------------------------------------------------------------
/system/Language/en/Errors.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | // Errors language settings
15 | return [
16 | 'pageNotFound' => '404 - Page Not Found',
17 | 'sorryCannotFind' => 'Sorry! Cannot seem to find the page you were looking for.',
18 | 'badRequest' => '400 - Bad Request',
19 | 'sorryBadRequest' => 'Sorry! Something is wrong with your request.',
20 | 'whoops' => 'Whoops!',
21 | 'weHitASnag' => 'We seem to have hit a snag. Please try again later...',
22 | ];
23 |
--------------------------------------------------------------------------------
/system/Language/en/Fabricator.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | // Fabricator language settings
15 | return [
16 | 'invalidModel' => 'Invalid model supplied for fabrication.',
17 | 'missingFormatters' => 'No valid formatters defined.',
18 | 'createFailed' => 'Fabricator failed to insert on table "{0}": {1}',
19 | ];
20 |
--------------------------------------------------------------------------------
/system/Language/en/Files.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | // Files language settings
15 | return [
16 | 'fileNotFound' => 'File not found: "{0}"',
17 | 'cannotMove' => 'Could not move file "{0}" to "{1}". Reason: {2}',
18 | 'expectedDirectory' => '{0} expects a valid directory.',
19 | 'expectedFile' => '{0} expects a valid file.',
20 | ];
21 |
--------------------------------------------------------------------------------
/system/Language/en/Filters.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | // Filters language settings
15 | return [
16 | 'noFilter' => '"{0}" filter must have a matching alias defined.',
17 | 'incorrectInterface' => '"{0}" must implement CodeIgniter\Filters\FilterInterface.',
18 | ];
19 |
--------------------------------------------------------------------------------
/system/Language/en/Format.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | // Format language settings
15 | return [
16 | 'invalidFormatter' => '"{0}" is not a valid Formatter class.',
17 | 'invalidJSON' => 'Failed to parse JSON string. Error: {0}',
18 | 'invalidMime' => 'No Formatter defined for mime type: "{0}".',
19 | 'missingExtension' => 'The SimpleXML extension is required to format XML.',
20 | ];
21 |
--------------------------------------------------------------------------------
/system/Language/en/Language.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | // "Language" language settings
15 | return [
16 | 'invalidMessageFormat' => 'Invalid message format: "{0}", args: "{1}"',
17 | ];
18 |
--------------------------------------------------------------------------------
/system/Language/en/Log.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | // Log language settings
15 | return [
16 | 'invalidLogLevel' => '"{0}" is an invalid log level.',
17 | 'invalidMessageType' => 'The given message type "{0}" is not supported.',
18 | ];
19 |
--------------------------------------------------------------------------------
/system/Language/en/Number.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | // Number language settings
15 | return [
16 | 'terabyteAbbr' => 'TB',
17 | 'gigabyteAbbr' => 'GB',
18 | 'megabyteAbbr' => 'MB',
19 | 'kilobyteAbbr' => 'KB',
20 | 'bytes' => 'Bytes',
21 |
22 | // don't forget the space in front of these!
23 | 'thousand' => ' thousand',
24 | 'million' => ' million',
25 | 'billion' => ' billion',
26 | 'trillion' => ' trillion',
27 | 'quadrillion' => ' quadrillion',
28 | ];
29 |
--------------------------------------------------------------------------------
/system/Language/en/Pager.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | // Pager language settings
15 | return [
16 | 'pageNavigation' => 'Page navigation',
17 | 'first' => 'First',
18 | 'previous' => 'Previous',
19 | 'next' => 'Next',
20 | 'last' => 'Last',
21 | 'older' => 'Older',
22 | 'newer' => 'Newer',
23 | 'invalidTemplate' => '"{0}" is not a valid Pager template.',
24 | 'invalidPaginationGroup' => '"{0}" is not a valid Pagination group.',
25 | ];
26 |
--------------------------------------------------------------------------------
/system/Language/en/Publisher.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | // Publisher language settings
15 | return [
16 | 'collision' => 'Publisher encountered an unexpected "{0}" while copying "{1}" to "{2}".',
17 | 'destinationNotAllowed' => 'Destination is not on the allowed list of Publisher directories: "{0}"',
18 | 'fileNotAllowed' => '"{0}" fails the following restriction for "{1}": {2}',
19 |
20 | // Publish Command
21 | 'publishMissing' => 'No Publisher classes detected in {0} across all namespaces.',
22 | 'publishMissingNamespace' => 'No Publisher classes detected in {0} in the {1} namespace.',
23 | 'publishSuccess' => '"{0}" published {1} file(s) to "{2}".',
24 | 'publishFailure' => '"{0}" failed to publish to "{1}".',
25 | ];
26 |
--------------------------------------------------------------------------------
/system/Language/en/RESTful.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | // RESTful language settings
15 | return [
16 | 'notImplemented' => '"{0}" action not implemented.',
17 | ];
18 |
--------------------------------------------------------------------------------
/system/Language/en/Router.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | // Router language settings
15 | return [
16 | 'invalidParameter' => 'A parameter does not match the expected type.',
17 | 'missingDefaultRoute' => 'Unable to determine what should be displayed. A default route has not been specified in the routing file.',
18 | 'invalidDynamicController' => 'A dynamic controller is not allowed for security reasons. Route handler: "{0}"',
19 | 'invalidControllerName' => 'The namespace delimiter is a backslash (\), not a slash (/). Route handler: "{0}"',
20 | ];
21 |
--------------------------------------------------------------------------------
/system/Language/en/Security.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | // Security language settings
15 | return [
16 | 'disallowedAction' => 'The action you requested is not allowed.',
17 | 'insecureCookie' => 'Attempted to send a secure cookie over a non-secure connection.',
18 |
19 | // @deprecated
20 | 'invalidSameSite' => 'The SameSite value must be None, Lax, Strict, or a blank string. Given: "{0}"',
21 | ];
22 |
--------------------------------------------------------------------------------
/system/Language/en/Session.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | // Session language settings
15 | return [
16 | 'missingDatabaseTable' => '"sessionSavePath" must have the table name for the Database Session Handler to work.',
17 | 'invalidSavePath' => 'Session: Configured save path "{0}" is not a directory, does not exist or cannot be created.',
18 | 'writeProtectedSavePath' => 'Session: Configured save path "{0}" is not writable by the PHP process.',
19 | 'emptySavePath' => 'Session: No save path configured.',
20 | 'invalidSavePathFormat' => 'Session: Invalid Redis save path format: "{0}"',
21 |
22 | // @deprecated
23 | 'invalidSameSiteSetting' => 'Session: The SameSite setting must be None, Lax, Strict, or a blank string. Given: "{0}"',
24 | ];
25 |
--------------------------------------------------------------------------------
/system/Language/en/Test.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | // Testing language settings
15 | return [
16 | 'invalidMockClass' => '"{0}" is not a valid Mock class',
17 | ];
18 |
--------------------------------------------------------------------------------
/system/Language/en/Time.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | // Time language settings
15 | return [
16 | 'invalidFormat' => '"{0}" is not a valid datetime format',
17 | 'invalidMonth' => 'Months must be between 1 and 12. Given: {0}',
18 | 'invalidDay' => 'Days must be between 1 and 31. Given: {0}',
19 | 'invalidOverDay' => 'Days must be between 1 and {0}. Given: {1}',
20 | 'invalidHours' => 'Hours must be between 0 and 23. Given: {0}',
21 | 'invalidMinutes' => 'Minutes must be between 0 and 59. Given: {0}',
22 | 'invalidSeconds' => 'Seconds must be between 0 and 59. Given: {0}',
23 | 'years' => '{0, plural, =1{# year} other{# years}}',
24 | 'months' => '{0, plural, =1{# month} other{# months}}',
25 | 'weeks' => '{0, plural, =1{# week} other{# weeks}}',
26 | 'days' => '{0, plural, =1{# day} other{# days}}',
27 | 'hours' => '{0, plural, =1{# hour} other{# hours}}',
28 | 'minutes' => '{0, plural, =1{# minute} other{# minutes}}',
29 | 'seconds' => '{0, plural, =1{# second} other{# seconds}}',
30 | 'ago' => '{0} ago',
31 | 'inFuture' => 'in {0}',
32 | 'yesterday' => 'Yesterday',
33 | 'tomorrow' => 'Tomorrow',
34 | 'now' => 'Just now',
35 | ];
36 |
--------------------------------------------------------------------------------
/system/Language/en/View.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | // View language settings
15 | return [
16 | 'invalidCellMethod' => '{class}::{method} is not a valid method.',
17 | 'missingCellParameters' => '{class}::{method} has no params.',
18 | 'invalidCellParameter' => '"{0}" is not a valid param name.',
19 | 'noCellClass' => 'No view cell class provided.',
20 | 'invalidCellClass' => 'Unable to locate view cell class: "{0}".',
21 | 'tagSyntaxError' => 'You have a syntax error in your Parser tags: "{0}"',
22 | 'invalidDecoratorClass' => '"{0}" is not a valid View Decorator.',
23 | ];
24 |
--------------------------------------------------------------------------------
/system/Log/Exceptions/LogException.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\Log\Exceptions;
15 |
16 | use CodeIgniter\Exceptions\FrameworkException;
17 |
18 | class LogException extends FrameworkException
19 | {
20 | /**
21 | * @return static
22 | */
23 | public static function forInvalidLogLevel(string $level)
24 | {
25 | return new static(lang('Log.invalidLogLevel', [$level]));
26 | }
27 |
28 | /**
29 | * @return static
30 | */
31 | public static function forInvalidMessageType(string $messageType)
32 | {
33 | return new static(lang('Log.invalidMessageType', [$messageType]));
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/system/Log/Handlers/BaseHandler.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\Log\Handlers;
15 |
16 | /**
17 | * Base class for logging
18 | */
19 | abstract class BaseHandler implements HandlerInterface
20 | {
21 | /**
22 | * Handles
23 | *
24 | * @var array
25 | */
26 | protected $handles;
27 |
28 | /**
29 | * Date format for logging
30 | *
31 | * @var string
32 | */
33 | protected $dateFormat = 'Y-m-d H:i:s';
34 |
35 | /**
36 | * Constructor
37 | */
38 | public function __construct(array $config)
39 | {
40 | $this->handles = $config['handles'] ?? [];
41 | }
42 |
43 | /**
44 | * Checks whether the Handler will handle logging items of this
45 | * log Level.
46 | */
47 | public function canHandle(string $level): bool
48 | {
49 | return in_array($level, $this->handles, true);
50 | }
51 |
52 | /**
53 | * Stores the date format to use while logging messages.
54 | */
55 | public function setDateFormat(string $format): HandlerInterface
56 | {
57 | $this->dateFormat = $format;
58 |
59 | return $this;
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/system/Log/Handlers/HandlerInterface.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\Log\Handlers;
15 |
16 | /**
17 | * Expected behavior for a Log handler
18 | */
19 | interface HandlerInterface
20 | {
21 | /**
22 | * Handles logging the message.
23 | * If the handler returns false, then execution of handlers
24 | * will stop. Any handlers that have not run, yet, will not
25 | * be run.
26 | *
27 | * @param string $level
28 | * @param string $message
29 | */
30 | public function handle($level, $message): bool;
31 |
32 | /**
33 | * Checks whether the Handler will handle logging items of this
34 | * log Level.
35 | */
36 | public function canHandle(string $level): bool;
37 |
38 | /**
39 | * Sets the preferred date format to use when logging.
40 | *
41 | * @return HandlerInterface
42 | */
43 | public function setDateFormat(string $format);
44 | }
45 |
--------------------------------------------------------------------------------
/system/Pager/Exceptions/PagerException.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\Pager\Exceptions;
15 |
16 | use CodeIgniter\Exceptions\FrameworkException;
17 |
18 | class PagerException extends FrameworkException
19 | {
20 | /**
21 | * Throws when the template is invalid.
22 | *
23 | * @return static
24 | */
25 | public static function forInvalidTemplate(?string $template = null)
26 | {
27 | return new static(lang('Pager.invalidTemplate', [$template]));
28 | }
29 |
30 | /**
31 | * Throws when the group is invalid.
32 | *
33 | * @return static
34 | */
35 | public static function forInvalidPaginationGroup(?string $group = null)
36 | {
37 | return new static(lang('Pager.invalidPaginationGroup', [$group]));
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/system/Pager/Views/default_full.php:
--------------------------------------------------------------------------------
1 | setSurroundCount(2);
9 | ?>
10 |
11 |
48 |
--------------------------------------------------------------------------------
/system/Pager/Views/default_head.php:
--------------------------------------------------------------------------------
1 |
7 | *
8 | * For the full copyright and license information, please view
9 | * the LICENSE file that was distributed with this source code.
10 | */
11 |
12 | use CodeIgniter\Pager\PagerRenderer;
13 |
14 | /**
15 | * @var PagerRenderer $pager
16 | */
17 | $pager->setSurroundCount(0);
18 |
19 | if ($pager->hasPrevious()) {
20 | echo '' . PHP_EOL;
21 | }
22 |
23 | echo '' . PHP_EOL;
24 |
25 | if ($pager->hasNext()) {
26 | echo '' . PHP_EOL;
27 | }
28 |
--------------------------------------------------------------------------------
/system/Pager/Views/default_simple.php:
--------------------------------------------------------------------------------
1 | setSurroundCount(0);
9 | ?>
10 |
24 |
--------------------------------------------------------------------------------
/system/Router/AutoRouterInterface.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\Router;
15 |
16 | /**
17 | * Expected behavior of a AutoRouter.
18 | */
19 | interface AutoRouterInterface
20 | {
21 | /**
22 | * Returns controller, method and params from the URI.
23 | *
24 | * @return array [directory_name, controller_name, controller_method, params]
25 | */
26 | public function getRoute(string $uri, string $httpVerb): array;
27 | }
28 |
--------------------------------------------------------------------------------
/system/Router/Exceptions/ExceptionInterface.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\Router\Exceptions;
15 |
16 | /**
17 | * Provides a domain-level interface for broad capture
18 | * of all Router-related exceptions.
19 | *
20 | * catch (\CodeIgniter\Router\Exceptions\ExceptionInterface) { ... }
21 | */
22 | interface ExceptionInterface extends \CodeIgniter\Exceptions\ExceptionInterface
23 | {
24 | }
25 |
--------------------------------------------------------------------------------
/system/Router/Exceptions/MethodNotFoundException.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\Router\Exceptions;
15 |
16 | use CodeIgniter\Exceptions\RuntimeException;
17 |
18 | /**
19 | * @internal
20 | */
21 | final class MethodNotFoundException extends RuntimeException implements ExceptionInterface
22 | {
23 | }
24 |
--------------------------------------------------------------------------------
/system/Session/Handlers/Database/MySQLiHandler.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\Session\Handlers\Database;
15 |
16 | use CodeIgniter\Session\Handlers\DatabaseHandler;
17 |
18 | /**
19 | * Session handler for MySQLi
20 | *
21 | * @see \CodeIgniter\Session\Handlers\Database\MySQLiHandlerTest
22 | */
23 | class MySQLiHandler extends DatabaseHandler
24 | {
25 | /**
26 | * Lock the session.
27 | */
28 | protected function lockSession(string $sessionID): bool
29 | {
30 | $arg = md5($sessionID . ($this->matchIP ? '_' . $this->ipAddress : ''));
31 | if ($this->db->query("SELECT GET_LOCK('{$arg}', 300) AS ci_session_lock")->getRow()->ci_session_lock) {
32 | $this->lock = $arg;
33 |
34 | return true;
35 | }
36 |
37 | return $this->fail();
38 | }
39 |
40 | /**
41 | * Releases the lock, if any.
42 | */
43 | protected function releaseLock(): bool
44 | {
45 | if (! $this->lock) {
46 | return true;
47 | }
48 |
49 | if ($this->db->query("SELECT RELEASE_LOCK('{$this->lock}') AS ci_session_lock")->getRow()->ci_session_lock) {
50 | $this->lock = false;
51 |
52 | return true;
53 | }
54 |
55 | return $this->fail();
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/system/Superglobals.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter;
15 |
16 | /**
17 | * Superglobals manipulation.
18 | *
19 | * @internal
20 | * @see \CodeIgniter\SuperglobalsTest
21 | */
22 | final class Superglobals
23 | {
24 | private array $server;
25 | private array $get;
26 |
27 | public function __construct(?array $server = null, ?array $get = null)
28 | {
29 | $this->server = $server ?? $_SERVER;
30 | $this->get = $get ?? $_GET;
31 | }
32 |
33 | public function server(string $key): ?string
34 | {
35 | return $this->server[$key] ?? null;
36 | }
37 |
38 | public function setServer(string $key, string $value): void
39 | {
40 | $this->server[$key] = $value;
41 | $_SERVER[$key] = $value;
42 | }
43 |
44 | /**
45 | * @return array|string|null
46 | */
47 | public function get(string $key)
48 | {
49 | return $this->get[$key] ?? null;
50 | }
51 |
52 | public function setGet(string $key, string $value): void
53 | {
54 | $this->get[$key] = $value;
55 | $_GET[$key] = $value;
56 | }
57 |
58 | public function setGetArray(array $array): void
59 | {
60 | $this->get = $array;
61 | $_GET = $array;
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/system/Test/ConfigFromArrayTrait.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\Test;
15 |
16 | use CodeIgniter\Exceptions\LogicException;
17 |
18 | trait ConfigFromArrayTrait
19 | {
20 | /**
21 | * Creates a Config instance from an array.
22 | *
23 | * @template T of \CodeIgniter\Config\BaseConfig
24 | *
25 | * @param class-string $classname Config classname
26 | * @param array $config
27 | *
28 | * @return T
29 | */
30 | private function createConfigFromArray(string $classname, array $config)
31 | {
32 | $configObj = new $classname();
33 |
34 | foreach ($config as $key => $value) {
35 | if (property_exists($configObj, $key)) {
36 | $configObj->{$key} = $value;
37 |
38 | continue;
39 | }
40 |
41 | throw new LogicException(
42 | 'No such property: ' . $classname . '::$' . $key,
43 | );
44 | }
45 |
46 | return $configObj;
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/system/Test/IniTestTrait.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\Test;
15 |
16 | trait IniTestTrait
17 | {
18 | private array $iniSettings = [];
19 |
20 | private function backupIniValues(array $keys): void
21 | {
22 | foreach ($keys as $key) {
23 | $this->iniSettings[$key] = ini_get($key);
24 | }
25 | }
26 |
27 | private function restoreIniValues(): void
28 | {
29 | foreach ($this->iniSettings as $key => $value) {
30 | ini_set($key, $value);
31 | }
32 |
33 | $this->iniSettings = [];
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/system/Test/Mock/MockAppConfig.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\Test\Mock;
15 |
16 | use Config\App;
17 |
18 | class MockAppConfig extends App
19 | {
20 | public string $baseURL = 'http://example.com/';
21 | public string $uriProtocol = 'REQUEST_URI';
22 | public array $proxyIPs = [];
23 | public bool $CSPEnabled = false;
24 | public string $defaultLocale = 'en';
25 | public bool $negotiateLocale = false;
26 | public array $supportedLocales = [
27 | 'en',
28 | 'es',
29 | ];
30 | }
31 |
--------------------------------------------------------------------------------
/system/Test/Mock/MockAutoload.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\Test\Mock;
15 |
16 | use Config\Autoload;
17 |
18 | class MockAutoload extends Autoload
19 | {
20 | public $psr4 = [];
21 | public $classmap = [];
22 |
23 | public function __construct()
24 | {
25 | // Don't call the parent since we don't want the default mappings.
26 | // parent::__construct();
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/system/Test/Mock/MockBuilder.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\Test\Mock;
15 |
16 | use CodeIgniter\Database\BaseBuilder;
17 |
18 | class MockBuilder extends BaseBuilder
19 | {
20 | protected $supportedIgnoreStatements = [
21 | 'update' => 'IGNORE',
22 | 'insert' => 'IGNORE',
23 | 'delete' => 'IGNORE',
24 | ];
25 | }
26 |
--------------------------------------------------------------------------------
/system/Test/Mock/MockCLIConfig.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\Test\Mock;
15 |
16 | use Config\App;
17 |
18 | class MockCLIConfig extends App
19 | {
20 | public string $baseURL = 'http://example.com/';
21 | public string $uriProtocol = 'REQUEST_URI';
22 | public array $proxyIPs = [];
23 | public string $CSRFTokenName = 'csrf_test_name';
24 | public string $CSRFCookieName = 'csrf_cookie_name';
25 | public int $CSRFExpire = 7200;
26 | public bool $CSRFRegenerate = true;
27 | public $CSRFExcludeURIs = ['http://example.com'];
28 | public string $CSRFSameSite = 'Lax';
29 | public bool $CSPEnabled = false;
30 | public string $defaultLocale = 'en';
31 | public bool $negotiateLocale = false;
32 | public array $supportedLocales = [
33 | 'en',
34 | 'es',
35 | ];
36 | }
37 |
--------------------------------------------------------------------------------
/system/Test/Mock/MockCURLRequest.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\Test\Mock;
15 |
16 | use CodeIgniter\HTTP\CURLRequest;
17 | use CodeIgniter\HTTP\URI;
18 |
19 | /**
20 | * Simply allows us to not actually call cURL during the
21 | * test runs. Instead, we can set the desired output
22 | * and get back the set options.
23 | */
24 | class MockCURLRequest extends CURLRequest
25 | {
26 | public $curl_options;
27 | protected $output = '';
28 |
29 | /**
30 | * @param string $output
31 | *
32 | * @return $this
33 | */
34 | public function setOutput($output)
35 | {
36 | $this->output = $output;
37 |
38 | return $this;
39 | }
40 |
41 | protected function sendRequest(array $curlOptions = []): string
42 | {
43 | $this->response = clone $this->responseOrig;
44 |
45 | // Save so we can access later.
46 | $this->curl_options = $curlOptions;
47 |
48 | return $this->output;
49 | }
50 |
51 | /**
52 | * for testing purposes only
53 | *
54 | * @return URI
55 | */
56 | public function getBaseURI()
57 | {
58 | return $this->baseURI;
59 | }
60 |
61 | /**
62 | * for testing purposes only
63 | *
64 | * @return float
65 | */
66 | public function getDelay()
67 | {
68 | return $this->delay;
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/system/Test/Mock/MockCodeIgniter.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\Test\Mock;
15 |
16 | use CodeIgniter\CodeIgniter;
17 |
18 | class MockCodeIgniter extends CodeIgniter
19 | {
20 | protected ?string $context = 'web';
21 |
22 | /**
23 | * @param int $code
24 | *
25 | * @deprecated 4.4.0 No longer Used. Moved to index.php.
26 | */
27 | protected function callExit($code)
28 | {
29 | // Do not call exit() in testing.
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/system/Test/Mock/MockCommon.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | if (! function_exists('is_cli')) {
15 | /**
16 | * Is CLI?
17 | *
18 | * Test to see if a request was made from the command line.
19 | * You can set the return value for testing.
20 | *
21 | * @param bool $newReturn return value to set
22 | */
23 | function is_cli(?bool $newReturn = null): bool
24 | {
25 | // PHPUnit always runs via CLI.
26 | static $returnValue = true;
27 |
28 | if ($newReturn !== null) {
29 | $returnValue = $newReturn;
30 | }
31 |
32 | return $returnValue;
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/system/Test/Mock/MockEmail.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\Test\Mock;
15 |
16 | use CodeIgniter\Email\Email;
17 | use CodeIgniter\Events\Events;
18 |
19 | class MockEmail extends Email
20 | {
21 | /**
22 | * Value to return from mocked send().
23 | *
24 | * @var bool
25 | */
26 | public $returnValue = true;
27 |
28 | public function send($autoClear = true)
29 | {
30 | if ($this->returnValue) {
31 | $this->setArchiveValues();
32 |
33 | if ($autoClear) {
34 | $this->clear();
35 | }
36 |
37 | Events::trigger('email', $this->archive);
38 | }
39 |
40 | return $this->returnValue;
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/system/Test/Mock/MockEvents.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\Test\Mock;
15 |
16 | use CodeIgniter\Events\Events;
17 |
18 | class MockEvents extends Events
19 | {
20 | /**
21 | * @return array
22 | */
23 | public function getListeners()
24 | {
25 | return self::$listeners;
26 | }
27 |
28 | /**
29 | * @return array
30 | */
31 | public function getEventsFile()
32 | {
33 | return self::$files;
34 | }
35 |
36 | /**
37 | * @return bool
38 | */
39 | public function getSimulate()
40 | {
41 | return self::$simulate;
42 | }
43 |
44 | /**
45 | * @return void
46 | */
47 | public function unInitialize()
48 | {
49 | static::$initialized = false;
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/system/Test/Mock/MockFileLogger.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\Test\Mock;
15 |
16 | use CodeIgniter\Log\Handlers\FileHandler;
17 |
18 | /**
19 | * Class MockFileLogger
20 | *
21 | * Extends FileHandler, exposing some inner workings
22 | */
23 | class MockFileLogger extends FileHandler
24 | {
25 | /**
26 | * Where would the log be written?
27 | */
28 | public $destination;
29 |
30 | public function __construct(array $config)
31 | {
32 | parent::__construct($config);
33 | $this->handles = $config['handles'] ?? [];
34 | $this->destination = $this->path . 'log-' . date('Y-m-d') . '.' . $this->fileExtension;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/system/Test/Mock/MockIncomingRequest.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\Test\Mock;
15 |
16 | use CodeIgniter\HTTP\IncomingRequest;
17 |
18 | class MockIncomingRequest extends IncomingRequest
19 | {
20 | }
21 |
--------------------------------------------------------------------------------
/system/Test/Mock/MockLanguage.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\Test\Mock;
15 |
16 | use CodeIgniter\Language\Language;
17 |
18 | class MockLanguage extends Language
19 | {
20 | /**
21 | * Stores the data that should be
22 | * returned by the 'requireFile()' method.
23 | *
24 | * @var mixed
25 | */
26 | protected $data;
27 |
28 | /**
29 | * Sets the data that should be returned by the
30 | * 'requireFile()' method to allow easy overrides
31 | * during testing.
32 | *
33 | * @return $this
34 | */
35 | public function setData(string $file, array $data, ?string $locale = null)
36 | {
37 | $this->language[$locale ?? $this->locale][$file] = $data;
38 |
39 | return $this;
40 | }
41 |
42 | /**
43 | * Provides an override that allows us to set custom
44 | * data to be returned easily during testing.
45 | */
46 | protected function requireFile(string $path): array
47 | {
48 | return $this->data ?? [];
49 | }
50 |
51 | /**
52 | * Arbitrarily turnoff internationalization support for testing
53 | *
54 | * @return void
55 | */
56 | public function disableIntlSupport()
57 | {
58 | $this->intlSupport = false;
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/system/Test/Mock/MockQuery.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\Test\Mock;
15 |
16 | use CodeIgniter\Database\Query;
17 |
18 | class MockQuery extends Query
19 | {
20 | }
21 |
--------------------------------------------------------------------------------
/system/Test/Mock/MockResourceController.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\Test\Mock;
15 |
16 | use CodeIgniter\RESTful\ResourceController;
17 |
18 | class MockResourceController extends ResourceController
19 | {
20 | /**
21 | * @return object|null
22 | */
23 | public function getModel()
24 | {
25 | return $this->model;
26 | }
27 |
28 | /**
29 | * @return class-string|null
30 | */
31 | public function getModelName()
32 | {
33 | return $this->modelName;
34 | }
35 |
36 | /**
37 | * @return 'json'|'xml'|null
38 | */
39 | public function getFormat()
40 | {
41 | return $this->format;
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/system/Test/Mock/MockResourcePresenter.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\Test\Mock;
15 |
16 | use CodeIgniter\API\ResponseTrait;
17 | use CodeIgniter\RESTful\ResourcePresenter;
18 |
19 | class MockResourcePresenter extends ResourcePresenter
20 | {
21 | use ResponseTrait;
22 |
23 | /**
24 | * @return object|null
25 | */
26 | public function getModel()
27 | {
28 | return $this->model;
29 | }
30 |
31 | /**
32 | * @return class-string|null
33 | */
34 | public function getModelName()
35 | {
36 | return $this->modelName;
37 | }
38 |
39 | /**
40 | * @return 'json'|'xml'|null
41 | */
42 | public function getFormat()
43 | {
44 | return $this->format;
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/system/Test/Mock/MockResponse.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\Test\Mock;
15 |
16 | use CodeIgniter\HTTP\Response;
17 |
18 | class MockResponse extends Response
19 | {
20 | /**
21 | * If true, will not write output. Useful during testing.
22 | *
23 | * @var bool
24 | */
25 | protected $pretend = true;
26 |
27 | /**
28 | * For testing.
29 | *
30 | * @return bool
31 | */
32 | public function getPretend()
33 | {
34 | return $this->pretend;
35 | }
36 |
37 | /**
38 | * Artificial error for testing
39 | *
40 | * @return void
41 | */
42 | public function misbehave()
43 | {
44 | $this->statusCode = 0;
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/system/Test/Mock/MockSecurity.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\Test\Mock;
15 |
16 | use CodeIgniter\Security\Security;
17 |
18 | class MockSecurity extends Security
19 | {
20 | protected function doSendCookie(): void
21 | {
22 | $_COOKIE['csrf_cookie_name'] = $this->hash;
23 | }
24 |
25 | protected function randomize(string $hash): string
26 | {
27 | $keyBinary = hex2bin('005513c290126d34d41bf41c5265e0f1');
28 | $hashBinary = hex2bin($hash);
29 |
30 | return bin2hex(($hashBinary ^ $keyBinary) . $keyBinary);
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/system/Test/Mock/MockServices.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\Test\Mock;
15 |
16 | use CodeIgniter\Autoloader\FileLocator;
17 | use CodeIgniter\Config\BaseService;
18 |
19 | class MockServices extends BaseService
20 | {
21 | public $psr4 = [
22 | 'Tests/Support' => TESTPATH . '_support/',
23 | ];
24 | public $classmap = [];
25 |
26 | public function __construct()
27 | {
28 | // Don't call the parent since we don't want the default mappings.
29 | // parent::__construct();
30 | }
31 |
32 | public static function locator(bool $getShared = true)
33 | {
34 | return new FileLocator(static::autoloader());
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/system/Test/Mock/MockTable.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\Test\Mock;
15 |
16 | use CodeIgniter\Exceptions\BadMethodCallException;
17 | use CodeIgniter\View\Table;
18 |
19 | class MockTable extends Table
20 | {
21 | /**
22 | * Override inaccessible protected method
23 | *
24 | * @param string $method
25 | * @param list $params
26 | *
27 | * @return mixed
28 | */
29 | public function __call($method, $params)
30 | {
31 | if (is_callable([$this, '_' . $method])) {
32 | return call_user_func_array([$this, '_' . $method], $params);
33 | }
34 |
35 | throw new BadMethodCallException('Method ' . $method . ' was not found');
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/system/Test/StreamFilterTrait.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\Test;
15 |
16 | use CodeIgniter\Test\Filters\CITestStreamFilter;
17 |
18 | trait StreamFilterTrait
19 | {
20 | protected function setUpStreamFilterTrait(): void
21 | {
22 | CITestStreamFilter::registration();
23 | CITestStreamFilter::addOutputFilter();
24 | CITestStreamFilter::addErrorFilter();
25 | }
26 |
27 | protected function tearDownStreamFilterTrait(): void
28 | {
29 | CITestStreamFilter::removeOutputFilter();
30 | CITestStreamFilter::removeErrorFilter();
31 | }
32 |
33 | protected function getStreamFilterBuffer(): string
34 | {
35 | return CITestStreamFilter::$buffer;
36 | }
37 |
38 | protected function resetStreamFilterBuffer(): void
39 | {
40 | CITestStreamFilter::$buffer = '';
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/system/ThirdParty/Escaper/Exception/ExceptionInterface.php:
--------------------------------------------------------------------------------
1 | ';
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/system/ThirdParty/Kint/Value/UninitializedValue.php:
--------------------------------------------------------------------------------
1 | logger = $logger;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/system/ThirdParty/PSR/Log/NullLogger.php:
--------------------------------------------------------------------------------
1 | logger) { }`
11 | * blocks.
12 | */
13 | class NullLogger extends AbstractLogger
14 | {
15 | /**
16 | * Logs with an arbitrary level.
17 | *
18 | * @param mixed[] $context
19 | *
20 | * @throws \Psr\Log\InvalidArgumentException
21 | */
22 | public function log($level, string|\Stringable $message, array $context = []): void
23 | {
24 | // noop
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/system/Throttle/ThrottlerInterface.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\Throttle;
15 |
16 | /**
17 | * Expected behavior of a Throttler
18 | */
19 | interface ThrottlerInterface
20 | {
21 | /**
22 | * Restricts the number of requests made by a single key within
23 | * a set number of seconds.
24 | *
25 | * Example:
26 | *
27 | * if (! $throttler->checkIPAddress($request->ipAddress(), 60, MINUTE))
28 | * {
29 | * die('You submitted over 60 requests within a minute.');
30 | * }
31 | *
32 | * @param string $key The name to use as the "bucket" name.
33 | * @param int $capacity The number of requests the "bucket" can hold
34 | * @param int $seconds The time it takes the "bucket" to completely refill
35 | * @param int $cost The number of tokens this action uses.
36 | *
37 | * @return bool
38 | */
39 | public function check(string $key, int $capacity, int $seconds, int $cost);
40 |
41 | /**
42 | * Returns the number of seconds until the next available token will
43 | * be released for usage.
44 | */
45 | public function getTokenTime(): int;
46 | }
47 |
--------------------------------------------------------------------------------
/system/Validation/FileRules.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\Validation;
15 |
16 | use CodeIgniter\Validation\StrictRules\FileRules as StrictFileRules;
17 |
18 | /**
19 | * File validation rules
20 | *
21 | * @see \CodeIgniter\Validation\FileRulesTest
22 | */
23 | class FileRules extends StrictFileRules
24 | {
25 | }
26 |
--------------------------------------------------------------------------------
/system/Validation/Views/list.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | - = esc($error) ?>
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/system/Validation/Views/single.php:
--------------------------------------------------------------------------------
1 | = esc($error) ?>
2 |
--------------------------------------------------------------------------------
/system/View/ViewDecoratorInterface.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\View;
15 |
16 | /**
17 | * View Decorators are simple classes that are given the
18 | * chance to modify the output from the view() calls
19 | * prior to it being cached.
20 | */
21 | interface ViewDecoratorInterface
22 | {
23 | /**
24 | * Takes $html and has a chance to alter it.
25 | * MUST return the modified HTML.
26 | */
27 | public static function decorate(string $html): string;
28 | }
29 |
--------------------------------------------------------------------------------
/system/View/ViewDecoratorTrait.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | namespace CodeIgniter\View;
15 |
16 | use CodeIgniter\View\Exceptions\ViewException;
17 | use Config\View as ViewConfig;
18 |
19 | trait ViewDecoratorTrait
20 | {
21 | /**
22 | * Runs the generated output through any declared
23 | * view decorators.
24 | */
25 | protected function decorateOutput(string $html): string
26 | {
27 | $decorators = $this->config->decorators ?? config(ViewConfig::class)->decorators;
28 |
29 | foreach ($decorators as $decorator) {
30 | if (! is_subclass_of($decorator, ViewDecoratorInterface::class)) {
31 | throw ViewException::forInvalidDecorator($decorator);
32 | }
33 |
34 | $html = $decorator::decorate($html);
35 | }
36 |
37 | return $html;
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/system/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 403 Forbidden
5 |
6 |
7 |
8 | Directory access is forbidden.
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/system/rewrite.php:
--------------------------------------------------------------------------------
1 |
9 | *
10 | * For the full copyright and license information, please view
11 | * the LICENSE file that was distributed with this source code.
12 | */
13 |
14 | /*
15 | * CodeIgniter PHP-Development Server Rewrite Rules
16 | *
17 | * This script works with the CLI serve command to help run a seamless
18 | * development server based around PHP's built-in development
19 | * server. This file simply tries to mimic Apache's mod_rewrite
20 | * functionality so the site will operate as normal.
21 | */
22 |
23 | // @codeCoverageIgnoreStart
24 | $uri = urldecode(
25 | parse_url('https://codeigniter.com' . $_SERVER['REQUEST_URI'], PHP_URL_PATH) ?? '',
26 | );
27 |
28 | // All request handle by index.php file.
29 | $_SERVER['SCRIPT_NAME'] = '/index.php';
30 |
31 | // Full path
32 | $path = $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . ltrim($uri, '/');
33 |
34 | // If $path is an existing file or folder within the public folder
35 | // then let the request handle it like normal.
36 | if ($uri !== '/' && (is_file($path) || is_dir($path))) {
37 | return false;
38 | }
39 |
40 | unset($uri, $path);
41 |
42 | // Otherwise, we'll load the index file and let
43 | // the framework handle the request from here.
44 | require_once $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . 'index.php';
45 | // @codeCoverageIgnoreEnd
46 |
--------------------------------------------------------------------------------
/tests/.htaccess:
--------------------------------------------------------------------------------
1 |
2 | Require all denied
3 |
4 |
5 | Deny from all
6 |
7 |
--------------------------------------------------------------------------------
/tests/_support/Database/Migrations/2020-02-22-222222_example_migration.php:
--------------------------------------------------------------------------------
1 | forge->addField('id');
14 | $this->forge->addField([
15 | 'name' => ['type' => 'varchar', 'constraint' => 31],
16 | 'uid' => ['type' => 'varchar', 'constraint' => 31],
17 | 'class' => ['type' => 'varchar', 'constraint' => 63],
18 | 'icon' => ['type' => 'varchar', 'constraint' => 31],
19 | 'summary' => ['type' => 'varchar', 'constraint' => 255],
20 | 'created_at' => ['type' => 'datetime', 'null' => true],
21 | 'updated_at' => ['type' => 'datetime', 'null' => true],
22 | 'deleted_at' => ['type' => 'datetime', 'null' => true],
23 | ]);
24 |
25 | $this->forge->addKey('name');
26 | $this->forge->addKey('uid');
27 | $this->forge->addKey(['deleted_at', 'id']);
28 | $this->forge->addKey('created_at');
29 |
30 | $this->forge->createTable('factories');
31 | }
32 |
33 | public function down(): void
34 | {
35 | $this->forge->dropTable('factories');
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/tests/_support/Database/Seeds/ExampleSeeder.php:
--------------------------------------------------------------------------------
1 | 'Test Factory',
14 | 'uid' => 'test001',
15 | 'class' => 'Factories\Tests\NewFactory',
16 | 'icon' => 'fas fa-puzzle-piece',
17 | 'summary' => 'Longer sample text for testing',
18 | ],
19 | [
20 | 'name' => 'Widget Factory',
21 | 'uid' => 'widget',
22 | 'class' => 'Factories\Tests\WidgetPlant',
23 | 'icon' => 'fas fa-puzzle-piece',
24 | 'summary' => 'Create widgets in your factory',
25 | ],
26 | [
27 | 'name' => 'Evil Factory',
28 | 'uid' => 'evil-maker',
29 | 'class' => 'Factories\Evil\MyFactory',
30 | 'icon' => 'fas fa-book-dead',
31 | 'summary' => 'Abandon all hope, ye who enter here',
32 | ],
33 | ];
34 |
35 | $builder = $this->db->table('factories');
36 |
37 | foreach ($factories as $factory) {
38 | $builder->insert($factory);
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/tests/_support/Libraries/ConfigReader.php:
--------------------------------------------------------------------------------
1 | findAll();
23 |
24 | // Make sure the count is as expected
25 | $this->assertCount(3, $objects);
26 | }
27 |
28 | public function testSoftDeleteLeavesRow(): void
29 | {
30 | $model = new ExampleModel();
31 | $this->setPrivateProperty($model, 'useSoftDeletes', true);
32 | $this->setPrivateProperty($model, 'tempUseSoftDeletes', true);
33 |
34 | /** @var stdClass $object */
35 | $object = $model->first();
36 | $model->delete($object->id);
37 |
38 | // The model should no longer find it
39 | $this->assertNull($model->find($object->id));
40 |
41 | // ... but it should still be in the database
42 | $result = $model->builder()->where('id', $object->id)->get()->getResult();
43 |
44 | $this->assertCount(1, $result);
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/tests/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 403 Forbidden
5 |
6 |
7 |
8 | Directory access is forbidden.
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/tests/session/ExampleSessionTest.php:
--------------------------------------------------------------------------------
1 | set('logged_in', 123);
15 | $this->assertSame(123, $session->get('logged_in'));
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/tests/unit/HealthTest.php:
--------------------------------------------------------------------------------
1 | assertTrue(defined('APPPATH'));
15 | }
16 |
17 | public function testBaseUrlHasBeenSet(): void
18 | {
19 | $validation = service('validation');
20 |
21 | $env = false;
22 |
23 | // Check the baseURL in .env
24 | if (is_file(HOMEPATH . '.env')) {
25 | $env = preg_grep('/^app\.baseURL = ./', file(HOMEPATH . '.env')) !== false;
26 | }
27 |
28 | if ($env) {
29 | // BaseURL in .env is a valid URL?
30 | // phpunit.xml.dist sets app.baseURL in $_SERVER
31 | // So if you set app.baseURL in .env, it takes precedence
32 | $config = new App();
33 | $this->assertTrue(
34 | $validation->check($config->baseURL, 'valid_url'),
35 | 'baseURL "' . $config->baseURL . '" in .env is not valid URL',
36 | );
37 | }
38 |
39 | // Get the baseURL in app/Config/App.php
40 | // You can't use Config\App, because phpunit.xml.dist sets app.baseURL
41 | $reader = new ConfigReader();
42 |
43 | // BaseURL in app/Config/App.php is a valid URL?
44 | $this->assertTrue(
45 | $validation->check($reader->baseURL, 'valid_url'),
46 | 'baseURL "' . $reader->baseURL . '" in app/Config/App.php is not valid URL',
47 | );
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/writable/.htaccess:
--------------------------------------------------------------------------------
1 |
2 | Require all denied
3 |
4 |
5 | Deny from all
6 |
7 |
--------------------------------------------------------------------------------
/writable/cache/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 403 Forbidden
5 |
6 |
7 |
8 | Directory access is forbidden.
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/writable/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 403 Forbidden
5 |
6 |
7 |
8 | Directory access is forbidden.
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/writable/logs/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 403 Forbidden
5 |
6 |
7 |
8 | Directory access is forbidden.
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/writable/session/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 403 Forbidden
5 |
6 |
7 |
8 | Directory access is forbidden.
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/writable/uploads/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 403 Forbidden
5 |
6 |
7 |
8 | Directory access is forbidden.
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------