Function __global->require_code

Definitions

sources/global.php

  • Require a software PHP file while, where applicable, compiling in overrides from *_custom folders and contentious overrides.You should remember this function and use this opposed to require/include/require_once/include_once for proper modularity (except for bootstrap.php which has to be required directly).
  • Visibility: public
  • Is abstract?: No
  • Is static?: No
  • Is final?: No

Parameters

Name Type Passed by reference? Variadic? Default Set Range Description
$codename string No No required parameter N/A N/A The codename for the source module to load (or a full relative path, ending with .php; if custom checking is needed, this must be the custom version)
$light_exit boolean No No False N/A N/A Whether to cleanly fail when a source file is missing
$has_custom ?boolean No No Null N/A N/A Whether this is going to be from under a custom directory (null: search). This is used for performance to avoid extra searching when we already know where a file is
$force_custom boolean No No False N/A N/A Whether to forcefully allow custom overrides even if in safe mode (still ignored for files which do not support overrides)

Preview

Code (PHP)

/**
 * Require a software PHP file while, where applicable, compiling in overrides from *_custom folders and contentious overrides.You should remember this function and use this opposed to require/include/require_once/include_once for proper modularity (except for bootstrap.php which has to be required directly).
 *
 * @param  string $codename The codename for the source module to load (or a full relative path, ending with .php; if custom checking is needed, this must be the custom version)
 * @param  boolean $light_exit Whether to cleanly fail when a source file is missing
 * @param  ?boolean $has_custom Whether this is going to be from under a custom directory (null: search). This is used for performance to avoid extra searching when we already know where a file is
 * @param  boolean $force_custom Whether to forcefully allow custom overrides even if in safe mode (still ignored for files which do not support overrides)
 */

function require_code(string $codename, bool $light_exit = false, ?bool $has_custom = null, bool $force_custom = false)
 

sources/minikernel.php

  • This function is a very important one when coding. It allows you to include a source code file (from root/sources/ or root/sources_custom/) through the proper channels.You should remember this function, and not substitute anything else for it, as that will likely make your code unstable.It is key to source code modularity in Composr.
  • Visibility: public
  • Is abstract?: No
  • Is static?: No
  • Is final?: No

Parameters

Name Type Passed by reference? Variadic? Default Set Range Description
$codename string No No required parameter N/A N/A The codename for the source module to load

Preview

Code (PHP)

/**
 * This function is a very important one when coding. It allows you to include a source code file (from root/sources/ or root/sources_custom/) through the proper channels.You should remember this function, and not substitute anything else for it, as that will likely make your code unstable.It is key to source code modularity in Composr.
 *
 * @param  string $codename The codename for the source module to load
 */

function require_code(string $codename)