first commit

This commit is contained in:
2026-02-08 21:16:11 +01:00
commit e17b7026fd
8881 changed files with 1160453 additions and 0 deletions

View File

@@ -0,0 +1,340 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.

View File

@@ -0,0 +1,109 @@
<?php
/**
* Part of the Joomla Framework Controller Package.
*
* @copyright Copyright (C) 2005 - 2021 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
namespace _JchOptimizeVendor\Joomla\Controller;
use Joomla\Application\AbstractApplication;
use Joomla\Input\Input;
/**
* Joomla Framework Base Controller Class.
*
* @since 1.0
*/
abstract class AbstractController implements ControllerInterface
{
/**
* The application object.
*
* @var AbstractApplication
*
* @since 1.0
*/
private $app;
/**
* The input object.
*
* @var Input
*
* @since 1.0
*/
private $input;
/**
* Instantiate the controller.
*
* @param Input $input the input object
* @param AbstractApplication $app the application object
*
* @since 1.0
*/
public function __construct(?Input $input = null, ?AbstractApplication $app = null)
{
$this->input = $input;
$this->app = $app;
}
/**
* Get the application object.
*
* @return null|AbstractApplication
*
* @since 1.0
*/
public function getApplication()
{
return $this->app;
}
/**
* Get the input object.
*
* @return null|Input
*
* @since 1.0
*/
public function getInput()
{
return $this->input;
}
/**
* Set the application object.
*
* @param AbstractApplication $app the application object
*
* @return $this
*
* @since 1.0
*/
public function setApplication(AbstractApplication $app)
{
$this->app = $app;
return $this;
}
/**
* Set the input object.
*
* @param Input $input the input object
*
* @return $this
*
* @since 1.0
*/
public function setInput(Input $input)
{
$this->input = $input;
return $this;
}
}

View File

@@ -0,0 +1,32 @@
<?php
/**
* Part of the Joomla Framework Controller Package.
*
* @copyright Copyright (C) 2005 - 2021 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
namespace _JchOptimizeVendor\Joomla\Controller;
/**
* Joomla Framework Controller Interface.
*
* @since 1.0
*/
interface ControllerInterface
{
/**
* Execute the controller.
*
* @return bool True if controller finished execution, false if the controller did not
* finish execution. A controller might return false if some precondition for
* the controller to run has not been satisfied.
*
* @since 1.0
*
* @throws \LogicException
* @throws \RuntimeException
*/
public function execute();
}

View File

@@ -0,0 +1,624 @@
<?php
/**
* Part of the Joomla Framework Database Package.
*
* @copyright Copyright (C) 2005 - 2021 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
namespace Joomla\Database;
/**
* Joomla Framework Database Interface.
*
* @since 1.0
*/
interface DatabaseInterface
{
/**
* Connects to the database if needed.
*
* @since 2.0.0
*
* @throws \RuntimeException
*/
public function connect();
/**
* Determines if the connection to the server is active.
*
* @return bool
*
* @since 2.0.0
*/
public function connected();
/**
* Create a new database using information from $options object.
*
* @param \stdClass $options Object used to pass user and database name to database driver. This object must have "db_name" and "db_user" set.
* @param bool $utf true if the database supports the UTF-8 character set
*
* @return bool|resource
*
* @since 2.0.0
*
* @throws \RuntimeException
*/
public function createDatabase($options, $utf = \true);
/**
* Replace special placeholder representing binary field with the original string.
*
* @param resource|string $data encoded string or resource
*
* @return string the original string
*
* @since 1.7.0
*/
public function decodeBinary($data);
/**
* Disconnects the database.
*
* @since 2.0.0
*/
public function disconnect();
/**
* Drops a table from the database.
*
* @param string $table the name of the database table to drop
* @param bool $ifExists optionally specify that the table must exist before it is dropped
*
* @return $this
*
* @since 2.0.0
*
* @throws \RuntimeException
*/
public function dropTable($table, $ifExists = \true);
/**
* Escapes a string for usage in an SQL statement.
*
* @param string $text the string to be escaped
* @param bool $extra optional parameter to provide extra escaping
*
* @return string the escaped string
*
* @since 2.0.0
*/
public function escape($text, $extra = \false);
/**
* Execute the SQL statement.
*
* @return bool
*
* @since 2.0.0
*
* @throws \RuntimeException
*/
public function execute();
/**
* Get the number of affected rows for the previous executed SQL statement.
*
* @return int
*
* @since 2.0.0
*/
public function getAffectedRows();
/**
* Method to get the database collation in use by sampling a text field of a table in the database.
*
* @return bool|string the collation in use by the database or boolean false if not supported
*
* @since 2.0.0
*/
public function getCollation();
/**
* Method that provides access to the underlying database connection.
*
* @return resource the underlying database connection resource
*
* @since 2.0.0
*/
public function getConnection();
/**
* Method to get the database connection collation, as reported by the driver.
*
* If the connector doesn't support reporting this value please return an empty string.
*
* @return string
*
* @since 2.0.0
*/
public function getConnectionCollation();
/**
* Method to get the database encryption details (cipher and protocol) in use.
*
* @return string the database encryption details
*
* @since 2.0.0
*/
public function getConnectionEncryption(): string;
/**
* Method to test if the database TLS connections encryption are supported.
*
* @return bool whether the database supports TLS connections encryption
*
* @since 2.0.0
*/
public function isConnectionEncryptionSupported(): bool;
/**
* Method to check whether the installed database version is supported by the database driver.
*
* @return bool True if the database version is supported
*
* @since 2.0.0
*/
public function isMinimumVersion();
/**
* Get the total number of SQL statements executed by the database driver.
*
* @return int
*
* @since 2.0.0
*/
public function getCount();
/**
* Returns a PHP date() function compliant date format for the database driver.
*
* @return string
*
* @since 2.0.0
*/
public function getDateFormat();
/**
* Get the minimum supported database version.
*
* @return string
*
* @since 2.0.0
*/
public function getMinimum();
/**
* Get the name of the database driver.
*
* @return string
*
* @since 2.0.0
*/
public function getName();
/**
* Get the null or zero representation of a timestamp for the database driver.
*
* @return string
*
* @since 2.0.0
*/
public function getNullDate();
/**
* Get the number of returned rows for the previous executed SQL statement.
*
* @return int
*
* @since 2.0.0
*/
public function getNumRows();
/**
* Get the current query object or a new QueryInterface object.
*
* @param bool $new false to return the current query object, True to return a new QueryInterface object
*
* @return QueryInterface
*
* @since 2.0.0
*
* @throws \RuntimeException
*/
public function getQuery($new = \false);
/**
* Get the server family type.
*
* @return string
*
* @since 2.0.0
*/
public function getServerType();
/**
* Retrieves field information about the given tables.
*
* @param string $table the name of the database table
* @param bool $typeOnly true (default) to only return field types
*
* @return array
*
* @since 2.0.0
*
* @throws \RuntimeException
*/
public function getTableColumns($table, $typeOnly = \true);
/**
* Retrieves field information about the given tables.
*
* @param mixed $tables a table name or a list of table names
*
* @return array
*
* @since 2.0.0
*
* @throws \RuntimeException
*/
public function getTableKeys($tables);
/**
* Method to get an array of all tables in the database.
*
* @return array
*
* @since 2.0.0
*
* @throws \RuntimeException
*/
public function getTableList();
/**
* Get the version of the database connector.
*
* @return string
*
* @since 2.0.0
*/
public function getVersion();
/**
* Determine whether or not the database engine supports UTF-8 character encoding.
*
* @return bool true if the database engine supports UTF-8 character encoding
*
* @since 2.0.0
*/
public function hasUtfSupport();
/**
* Method to get the auto-incremented value from the last INSERT statement.
*
* @return mixed the value of the auto-increment field from the last inserted row
*
* @since 2.0.0
*/
public function insertid();
/**
* Inserts a row into a table based on an object's properties.
*
* @param string $table the name of the database table to insert into
* @param object $object a reference to an object whose public properties match the table fields
* @param string $key The name of the primary key. If provided the object property is updated.
*
* @return bool
*
* @since 2.0.0
*
* @throws \RuntimeException
*/
public function insertObject($table, &$object, $key = null);
/**
* Test to see if the connector is available.
*
* @return bool
*
* @since 1.0
*/
public static function isSupported();
/**
* Method to get the first row of the result set from the database query as an associative array of ['field_name' => 'row_value'].
*
* @return mixed the return value or null if the query failed
*
* @since 2.0.0
*
* @throws \RuntimeException
*/
public function loadAssoc();
/**
* Method to get an array of the result set rows from the database query where each row is an associative array
* of ['field_name' => 'row_value']. The array of rows can optionally be keyed by a field name, but defaults to
* a sequential numeric array.
*
* NOTE: Choosing to key the result array by a non-unique field name can result in unwanted
* behavior and should be avoided.
*
* @param string $key the name of a field on which to key the result array
* @param string $column An optional column name. Instead of the whole row, only this column value will be in the result array.
*
* @return mixed the return value or null if the query failed
*
* @since 2.0.0
*
* @throws \RuntimeException
*/
public function loadAssocList($key = null, $column = null);
/**
* Method to get an array of values from the <var>$offset</var> field in each row of the result set from the database query.
*
* @param int $offset the row offset to use to build the result array
*
* @return mixed the return value or null if the query failed
*
* @since 2.0.0
*
* @throws \RuntimeException
*/
public function loadColumn($offset = 0);
/**
* Method to get the first row of the result set from the database query as an object.
*
* @param string $class the class name to use for the returned row object
*
* @return mixed the return value or null if the query failed
*
* @since 2.0.0
*
* @throws \RuntimeException
*/
public function loadObject($class = \stdClass::class);
/**
* Method to get an array of the result set rows from the database query where each row is an object. The array
* of objects can optionally be keyed by a field name, but defaults to a sequential numeric array.
*
* NOTE: Choosing to key the result array by a non-unique field name can result in unwanted behavior and should be avoided.
*
* @param string $key the name of a field on which to key the result array
* @param string $class the class name to use for the returned row objects
*
* @return mixed the return value or null if the query failed
*
* @since 2.0.0
*
* @throws \RuntimeException
*/
public function loadObjectList($key = '', $class = \stdClass::class);
/**
* Method to get the first field of the first row of the result set from the database query.
*
* @return mixed the return value or null if the query failed
*
* @since 2.0.0
*
* @throws \RuntimeException
*/
public function loadResult();
/**
* Method to get the first row of the result set from the database query as an array.
*
* Columns are indexed numerically so the first column in the result set would be accessible via <var>$row[0]</var>, etc.
*
* @return mixed the return value or null if the query failed
*
* @since 2.0.0
*
* @throws \RuntimeException
*/
public function loadRow();
/**
* Method to get an array of the result set rows from the database query where each row is an array. The array
* of objects can optionally be keyed by a field offset, but defaults to a sequential numeric array.
*
* NOTE: Choosing to key the result array by a non-unique field can result in unwanted behavior and should be avoided.
*
* @param string $key the name of a field on which to key the result array
*
* @return mixed the return value or null if the query failed
*
* @since 2.0.0
*
* @throws \RuntimeException
*/
public function loadRowList($key = null);
/**
* Locks a table in the database.
*
* @param string $tableName the name of the table to unlock
*
* @return $this
*
* @since 2.0.0
*
* @throws \RuntimeException
*/
public function lockTable($tableName);
/**
* Quotes and optionally escapes a string to database requirements for use in database queries.
*
* @param array|string $text a string or an array of strings to quote
* @param bool $escape true (default) to escape the string, false to leave it unchanged
*
* @return string
*
* @since 2.0.0
*/
public function quote($text, $escape = \true);
/**
* Quotes a binary string to database requirements for use in database queries.
*
* @param string $data a binary string to quote
*
* @return string the binary quoted input string
*
* @since 1.7.0
*/
public function quoteBinary($data);
/**
* Wrap an SQL statement identifier name such as column, table or database names in quotes to prevent injection
* risks and reserved word conflicts.
*
* @param array|string $name The identifier name to wrap in quotes, or an array of identifier names to wrap in quotes.
* Each type supports dot-notation name.
* @param array|string $as The AS query part associated to $name. It can be string or array, in latter case it has to be
* same length of $name; if is null there will not be any AS part for string or array element.
*
* @return array|string the quote wrapped name, same type of $name
*
* @since 2.0.0
*/
public function quoteName($name, $as = null);
/**
* Renames a table in the database.
*
* @param string $oldTable The name of the table to be renamed
* @param string $newTable the new name for the table
* @param string $backup Table prefix
* @param string $prefix For the table - used to rename constraints in non-mysql databases
*
* @return $this
*
* @since 2.0.0
*
* @throws \RuntimeException
*/
public function renameTable($oldTable, $newTable, $backup = null, $prefix = null);
/**
* This function replaces a string identifier with the configured table prefix.
*
* @param string $sql the SQL statement to prepare
* @param string $prefix the table prefix
*
* @return string the processed SQL statement
*
* @since 2.0.0
*/
public function replacePrefix($sql, $prefix = '#__');
/**
* Select a database for use.
*
* @param string $database the name of the database to select for use
*
* @return bool
*
* @since 2.0.0
*
* @throws \RuntimeException
*/
public function select($database);
/**
* Sets the SQL statement string for later execution.
*
* @param mixed $query the SQL statement to set either as a Query object or a string
* @param int $offset The affected row offset to set. {@deprecated 3.0 Use LimitableInterface::setLimit() instead}
* @param int $limit The maximum affected rows to set. {@deprecated 3.0 Use LimitableInterface::setLimit() instead}
*
* @return $this
*
* @since 2.0.0
*/
public function setQuery($query, $offset = 0, $limit = 0);
/**
* Method to commit a transaction.
*
* @param bool $toSavepoint if true, commit to the last savepoint
*
* @since 2.0.0
*
* @throws \RuntimeException
*/
public function transactionCommit($toSavepoint = \false);
/**
* Method to roll back a transaction.
*
* @param bool $toSavepoint if true, rollback to the last savepoint
*
* @since 2.0.0
*
* @throws \RuntimeException
*/
public function transactionRollback($toSavepoint = \false);
/**
* Method to initialize a transaction.
*
* @param bool $asSavepoint if true and a transaction is already active, a savepoint will be created
*
* @since 2.0.0
*
* @throws \RuntimeException
*/
public function transactionStart($asSavepoint = \false);
/**
* Method to truncate a table.
*
* @param string $table The table to truncate
*
* @since 2.0.0
*
* @throws \RuntimeException
*/
public function truncateTable($table);
/**
* Unlocks tables in the database.
*
* @return $this
*
* @since 2.0.0
*
* @throws \RuntimeException
*/
public function unlockTables();
/**
* Updates a row in a table based on an object's properties.
*
* @param string $table the name of the database table to update
* @param object $object a reference to an object whose public properties match the table fields
* @param array|string $key the name of the primary key
* @param bool $nulls true to update null fields or false to ignore them
*
* @return bool
*
* @since 2.0.0
*
* @throws \RuntimeException
*/
public function updateObject($table, &$object, $key, $nulls = \false);
}

View File

@@ -0,0 +1,340 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.

View File

@@ -0,0 +1,632 @@
<?php
/**
* Part of the Joomla Framework DI Package.
*
* @copyright Copyright (C) 2013 - 2018 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
namespace _JchOptimizeVendor\Joomla\DI;
use _JchOptimizeVendor\Joomla\DI\Exception\DependencyResolutionException;
use _JchOptimizeVendor\Joomla\DI\Exception\KeyNotFoundException;
use _JchOptimizeVendor\Joomla\DI\Exception\ProtectedKeyException;
use _JchOptimizeVendor\Psr\Container\ContainerInterface;
/**
* The Container class.
*
* @since 1.0
*/
class Container implements ContainerInterface
{
/**
* Holds the key aliases.
*
* Format:
* 'alias' => 'key'
*
* @var array
*
* @since 1.0
*/
protected $aliases = [];
/**
* Holds the resources.
*
* @var ContainerResource[]
*
* @since 2.0.0
*/
protected $resources = [];
/**
* Parent for hierarchical containers.
*
* In fact, this can be any PSR-11 compatible container, which gets decorated by this
*
* @var null|Container|ContainerInterface
*
* @since 1.0
*/
protected $parent;
/**
* Holds the service tag mapping.
*
* @var array
*
* @since 1.5.0
*/
protected $tags = [];
/**
* Constructor for the DI Container.
*
* @param null|ContainerInterface $parent parent for hierarchical containers
*
* @since 1.0
*/
public function __construct(?ContainerInterface $parent = null)
{
$this->parent = $parent;
}
/**
* Retrieve a resource.
*
* @param string $resourceName name of the resource to get
*
* @return mixed The requested resource
*
* @since 1.0
*
* @throws KeyNotFoundException
*/
public function get($resourceName)
{
$key = $this->resolveAlias($resourceName);
if (!isset($this->resources[$key])) {
if ($this->parent instanceof ContainerInterface && $this->parent->has($key)) {
return $this->parent->get($key);
}
throw new KeyNotFoundException(\sprintf("Resource '%s' has not been registered with the container.", $resourceName));
}
return $this->resources[$key]->getInstance();
}
/**
* Check if specified resource exists.
*
* @param string $resourceName name of the resource to check
*
* @return bool true if key is defined, false otherwise
*
* @since 1.5.0
*/
public function has($resourceName)
{
$key = $this->resolveAlias($resourceName);
if (!isset($this->resources[$key])) {
if ($this->parent instanceof ContainerInterface) {
return $this->parent->has($key);
}
return \false;
}
return \true;
}
/**
* Method to check if specified dataStore key exists.
*
* @param string $key name of the dataStore key to check
*
* @return bool True for success
*
* @since 1.0
* @deprecated 3.0 Use ContainerInterface::has() instead
*/
public function exists($key)
{
trigger_deprecation('joomla/di', '1.5.0', '%s() is deprecated and will be removed in 3.0, use %s::has() instead.', __METHOD__, ContainerInterface::class);
return $this->has($key);
}
/**
* Create an alias for a given key for easy access.
*
* @param string $alias The alias name
* @param string $key The key to alias
*
* @return $this
*
* @since 1.0
*/
public function alias($alias, $key)
{
$this->aliases[$alias] = $key;
return $this;
}
/**
* Check whether a resource is shared.
*
* @param string $resourceName name of the resource to check
*
* @since 2.0.0
*/
public function isShared(string $resourceName): bool
{
return $this->hasFlag($resourceName, 'isShared', \true);
}
/**
* Check whether a resource is protected.
*
* @param string $resourceName name of the resource to check
*
* @since 2.0.0
*/
public function isProtected(string $resourceName): bool
{
return $this->hasFlag($resourceName, 'isProtected', \true);
}
/**
* Assign a tag to services.
*
* @param string $tag The tag name
* @param array $keys The service keys to tag
*
* @return $this
*
* @since 1.5.0
*/
public function tag($tag, array $keys)
{
foreach ($keys as $key) {
$resolvedKey = $this->resolveAlias($key);
if (!isset($this->tags[$tag])) {
$this->tags[$tag] = [];
}
$this->tags[$tag][] = $resolvedKey;
}
// Prune duplicates
$this->tags[$tag] = \array_unique($this->tags[$tag]);
return $this;
}
/**
* Fetch all services registered to the given tag.
*
* @param string $tag The tag name
*
* @return array The resolved services for the given tag
*
* @since 1.5.0
*/
public function getTagged($tag)
{
$services = [];
if (isset($this->tags[$tag])) {
foreach ($this->tags[$tag] as $service) {
$services[] = $this->get($service);
}
}
return $services;
}
/**
* Build an object of the requested class.
*
* Creates an instance of the class specified by $resourceName with all dependencies injected.
* If the dependencies cannot be completely resolved, a DependencyResolutionException is thrown.
*
* @param string $resourceName the class name to build
* @param bool $shared true to create a shared resource
*
* @return false|object Instance of class specified by $resourceName with all dependencies injected.
* Returns an object if the class exists and false otherwise
*
* @since 1.0
*
* @throws DependencyResolutionException if the object could not be built (due to missing information)
*/
public function buildObject($resourceName, $shared = \false)
{
static $buildStack = [];
$key = $this->resolveAlias($resourceName);
if (\in_array($key, $buildStack, \true)) {
$buildStack = [];
throw new DependencyResolutionException(\sprintf('Cannot resolve circular dependency for "%s"', $key));
}
$buildStack[] = $key;
if ($this->has($key)) {
$resource = $this->get($key);
\array_pop($buildStack);
return $resource;
}
try {
$reflection = new \ReflectionClass($key);
} catch (\ReflectionException $e) {
\array_pop($buildStack);
return \false;
}
if (!$reflection->isInstantiable()) {
$buildStack = [];
if ($reflection->isInterface()) {
throw new DependencyResolutionException(\sprintf('There is no service for "%s" defined, cannot autowire a class service for an interface.', $key));
}
if ($reflection->isAbstract()) {
throw new DependencyResolutionException(\sprintf('There is no service for "%s" defined, cannot autowire an abstract class.', $key));
}
throw new DependencyResolutionException(\sprintf('"%s" cannot be instantiated.', $key));
}
$constructor = $reflection->getConstructor();
// If there are no parameters, just return a new object.
if (null === $constructor) {
// There is no constructor, just return a new object.
$callback = function () use ($key) {
return new $key();
};
} else {
$newInstanceArgs = $this->getMethodArgs($constructor);
$callback = function () use ($reflection, $newInstanceArgs) {
return $reflection->newInstanceArgs($newInstanceArgs);
};
}
$this->set($key, $callback, $shared);
$resource = $this->get($key);
\array_pop($buildStack);
return $resource;
}
/**
* Convenience method for building a shared object.
*
* @param string $resourceName the class name to build
*
* @return false|object Instance of class specified by $resourceName with all dependencies injected.
* Returns an object if the class exists and false otherwise
*
* @since 1.0
*/
public function buildSharedObject($resourceName)
{
return $this->buildObject($resourceName, \true);
}
/**
* Create a child Container with a new property scope that has the ability to access the parent scope when resolving.
*
* @return Container A new container with the current as a parent
*
* @since 1.0
*/
public function createChild()
{
return new static($this);
}
/**
* Extend a defined service Closure by wrapping the existing one with a new callable function.
*
* This works very similar to a decorator pattern. Note that this only works on service Closures
* that have been defined in the current container, not parent containers.
*
* @param string $resourceName the unique identifier for the Closure or property
* @param callable $callable a callable to wrap the original service Closure
*
* @since 1.0
*
* @throws KeyNotFoundException
*/
public function extend($resourceName, callable $callable)
{
$key = $this->resolveAlias($resourceName);
$resource = $this->getResource($key, \true);
$closure = function ($c) use ($callable, $resource) {
return $callable($resource->getInstance(), $c);
};
$this->set($key, $closure, $resource->isShared());
}
/**
* Set a resource to the container. If the value is null the resource is removed.
*
* @param string $key name of resources key to set
* @param mixed $value callable function to run or string to retrive when requesting the specified $key
* @param bool $shared true to create and store a shared instance
* @param bool $protected True to protect this item from being overwritten. Useful for services.
*
* @return $this
*
* @since 1.0
*
* @throws ProtectedKeyException thrown if the provided key is already set and is protected
*/
public function set($key, $value, $shared = \false, $protected = \false)
{
$key = $this->resolveAlias($key);
$hasKey = $this->has($key);
if ($hasKey && $this->isProtected($key)) {
throw new ProtectedKeyException(\sprintf("Key %s is protected and can't be overwritten.", $key));
}
if (null === $value && $hasKey) {
unset($this->resources[$key]);
return $this;
}
$mode = $shared ? ContainerResource::SHARE : ContainerResource::NO_SHARE;
$mode |= $protected ? ContainerResource::PROTECT : ContainerResource::NO_PROTECT;
$this->resources[$key] = new ContainerResource($this, $value, $mode);
return $this;
}
/**
* Shortcut method for creating protected keys.
*
* @param string $key name of dataStore key to set
* @param mixed $value callable function to run or string to retrive when requesting the specified $key
* @param bool $shared true to create and store a shared instance
*
* @return $this
*
* @since 1.0
*/
public function protect($key, $value, $shared = \false)
{
return $this->set($key, $value, $shared, \true);
}
/**
* Shortcut method for creating shared keys.
*
* @param string $key name of dataStore key to set
* @param mixed $value callable function to run or string to retrive when requesting the specified $key
* @param bool $protected True to protect this item from being overwritten. Useful for services.
*
* @return $this
*
* @since 1.0
*/
public function share($key, $value, $protected = \false)
{
return $this->set($key, $value, \true, $protected);
}
/**
* Get the raw data assigned to a key.
*
* @param string $key the key for which to get the stored item
* @param bool $bail Throw an exception, if the key is not found
*
* @return null|ContainerResource The resource if present, or null if instructed to not bail
*
* @since 2.0.0
*
* @throws KeyNotFoundException
*/
public function getResource(string $key, bool $bail = \false): ?ContainerResource
{
if (isset($this->resources[$key])) {
return $this->resources[$key];
}
if ($this->parent instanceof self) {
return $this->parent->getResource($key);
}
if ($this->parent instanceof ContainerInterface && $this->parent->has($key)) {
return new ContainerResource($this, $this->parent->get($key), ContainerResource::SHARE | ContainerResource::PROTECT);
}
if ($bail) {
throw new KeyNotFoundException(\sprintf('Key %s has not been registered with the container.', $key));
}
return null;
}
/**
* Method to force the container to return a new instance of the results of the callback for requested $key.
*
* @param string $key name of the resources key to get
*
* @return mixed results of running the callback for the specified key
*
* @since 1.0
*/
public function getNewInstance($key)
{
$key = $this->resolveAlias($key);
$this->getResource($key, \true)->reset();
return $this->get($key);
}
/**
* Register a service provider to the container.
*
* @param ServiceProviderInterface $provider the service provider to register
*
* @return $this
*
* @since 1.0
*/
public function registerServiceProvider(ServiceProviderInterface $provider)
{
$provider->register($this);
return $this;
}
/**
* Retrieve the keys for services assigned to this container.
*
* @return array
*
* @since 1.5.0
*/
public function getKeys()
{
return \array_unique(\array_merge(\array_keys($this->aliases), \array_keys($this->resources)));
}
/**
* Resolve a resource name.
*
* If the resource name is an alias, the corresponding key is returned.
* If the resource name is not an alias, the resource name is returned unchanged.
*
* @param string $resourceName the key to search for
*
* @return string
*
* @since 1.0
*/
protected function resolveAlias($resourceName)
{
return $this->aliases[$resourceName] ?? $resourceName;
}
/**
* Check whether a flag (i.e., one of 'shared' or 'protected') is set.
*
* @param string $resourceName name of the resource to check
* @param string $method Method to delegate to
* @param bool $default Default return value
*
* @since 2.0.0
*
* @throws KeyNotFoundException
*/
private function hasFlag(string $resourceName, string $method, bool $default = \true): bool
{
$key = $this->resolveAlias($resourceName);
if (isset($this->resources[$key])) {
return \call_user_func([$this->resources[$key], $method]);
}
if ($this->parent instanceof self) {
return \call_user_func([$this->parent, $method], $key);
}
if ($this->parent instanceof ContainerInterface && $this->parent->has($key)) {
// We don't know if the parent supports the 'shared' or 'protected' concept, so we assume the default
return $default;
}
throw new KeyNotFoundException(\sprintf("Resource '%s' has not been registered with the container.", $resourceName));
}
/**
* Build an array of method arguments.
*
* @param \ReflectionMethod $method method for which to build the argument array
*
* @return array array of arguments to pass to the method
*
* @since 1.0
*
* @throws DependencyResolutionException
*/
private function getMethodArgs(\ReflectionMethod $method): array
{
$methodArgs = [];
foreach ($method->getParameters() as $param) {
// Check for a typehinted dependency
if ($param->hasType()) {
$dependency = $param->getType();
// Don't support PHP 8 union types
if ($dependency instanceof \ReflectionUnionType) {
// If this is a nullable parameter, then don't error out
if ($param->allowsNull()) {
$methodArgs[] = null;
continue;
}
throw new DependencyResolutionException(\sprintf('Could not resolve the parameter "$%s" of "%s::%s()": Union typehints are not supported.', $param->name, $method->class, $method->name));
}
// Check for a class, if it doesn't have one then it is a scalar type, which we cannot handle if a mandatory argument
if ($dependency->isBuiltin()) {
// If the param is optional, then fall through to the optional param handling later in this method
if (!$param->isOptional()) {
$message = 'Could not resolve the parameter "$%s" of "%s::%s()":';
$message .= ' Scalar parameters cannot be autowired and the parameter does not have a default value.';
throw new DependencyResolutionException(\sprintf($message, $param->name, $method->class, $method->name));
}
} else {
$dependencyClassName = $dependency->getName();
// Check that class or interface exists
if (!\interface_exists($dependencyClassName) && !\class_exists($dependencyClassName)) {
// If this is a nullable parameter, then don't error out
if ($param->allowsNull()) {
$methodArgs[] = null;
continue;
}
throw new DependencyResolutionException(\sprintf('Could not resolve the parameter "$%s" of "%s::%s()": The "%s" class does not exist.', $param->name, $method->class, $method->name, $dependencyClassName));
}
// If the dependency class name is registered with this container or a parent, use it.
if (null !== $this->getResource($dependencyClassName)) {
$depObject = $this->get($dependencyClassName);
} else {
try {
$depObject = $this->buildObject($dependencyClassName);
} catch (DependencyResolutionException $exception) {
// If this is a nullable parameter, then don't error out
if ($param->allowsNull()) {
$methodArgs[] = null;
continue;
}
$message = 'Could not resolve the parameter "$%s" of "%s::%s()":';
$message .= ' No service for "%s" exists and the dependency could not be autowired.';
throw new DependencyResolutionException(\sprintf($message, $param->name, $method->class, $method->name, $dependencyClassName), 0, $exception);
}
}
if ($depObject instanceof $dependencyClassName) {
$methodArgs[] = $depObject;
continue;
}
}
}
// If there is a default parameter and it can be read, use it.
if ($param->isOptional() && $param->isDefaultValueAvailable()) {
try {
$methodArgs[] = $param->getDefaultValue();
continue;
} catch (\ReflectionException $exception) {
throw new DependencyResolutionException(\sprintf('Could not resolve the parameter "$%s" of "%s::%s()": Unable to read the default parameter value.', $param->name, $method->class, $method->name), 0, $exception);
}
}
// If an untyped variadic argument, skip it
if (!$param->hasType() && $param->isVariadic()) {
continue;
}
// At this point the argument cannot be resolved, most likely cause is an untyped required argument
throw new DependencyResolutionException(\sprintf('Could not resolve the parameter "$%s" of "%s::%s()": The argument is untyped and has no default value.', $param->name, $method->class, $method->name));
}
return $methodArgs;
}
}

View File

@@ -0,0 +1,29 @@
<?php
/**
* Part of the Joomla Framework DI Package.
*
* @copyright Copyright (C) 2013 - 2018 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
namespace _JchOptimizeVendor\Joomla\DI;
/**
* Defines the interface for a Container Aware class.
*
* @since 1.0
*/
interface ContainerAwareInterface
{
/**
* Set the DI container.
*
* @param Container $container the DI container
*
* @return mixed
*
* @since 1.0
*/
public function setContainer(Container $container);
}

View File

@@ -0,0 +1,63 @@
<?php
/**
* Part of the Joomla Framework DI Package.
*
* @copyright Copyright (C) 2013 - 2018 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
namespace _JchOptimizeVendor\Joomla\DI;
use _JchOptimizeVendor\Joomla\DI\Exception\ContainerNotFoundException;
/**
* Defines the trait for a Container Aware Class.
*
* @since 1.2
*/
trait ContainerAwareTrait
{
/**
* DI Container.
*
* @var Container
*
* @since 1.2
*/
private $container;
/**
* Set the DI container.
*
* @param Container $container the DI container
*
* @return $this
*
* @since 1.2
*/
public function setContainer(Container $container)
{
$this->container = $container;
return $this;
}
/**
* Get the DI container.
*
* @return Container
*
* @since 1.2
*
* @throws ContainerNotFoundException may be thrown if the container has not been set
*/
protected function getContainer()
{
if ($this->container) {
return $this->container;
}
throw new ContainerNotFoundException('Container not set in '.\get_class($this));
}
}

View File

@@ -0,0 +1,208 @@
<?php
/**
* Part of the Joomla Framework DI Package.
*
* @copyright Copyright (C) 2013 - 2018 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
namespace _JchOptimizeVendor\Joomla\DI;
/**
* Defines the representation of a resource.
*
* @since 2.0.0
*
* @internal
*/
final class ContainerResource
{
/**
* Defines the resource as non-shared.
*
* @const integer
*
* @since 2.0.0
*/
public const NO_SHARE = 0;
/**
* Defines the resource as shared.
*
* @const integer
*
* @since 2.0.0
*/
public const SHARE = 1;
/**
* Defines the resource as non-protected.
*
* @const integer
*
* @since 2.0.0
*/
public const NO_PROTECT = 0;
/**
* Defines the resource as protected.
*
* @const integer
*
* @since 2.0.0
*/
public const PROTECT = 2;
/**
* The container the resource is assigned to.
*
* @var Container
*
* @since 2.0.0
*/
private $container;
/**
* The object instance for a shared object.
*
* @var mixed
*
* @since 2.0.0
*/
private $instance;
/**
* The factory object.
*
* @var callable
*
* @since 2.0.0
*/
private $factory;
/**
* Flag if the resource is shared.
*
* @var bool
*
* @since 2.0.0
*/
private $shared = \false;
/**
* Flag if the resource is protected.
*
* @var bool
*
* @since 2.0.0
*/
private $protected = \false;
/**
* Create a resource representation.
*
* @param Container $container The container
* @param mixed $value The resource or its factory closure
* @param int $mode Resource mode, defaults to Resource::NO_SHARE | Resource::NO_PROTECT
*
* @since 2.0.0
*/
public function __construct(Container $container, $value, int $mode = 0)
{
$this->container = $container;
$this->shared = ($mode & self::SHARE) === self::SHARE;
$this->protected = ($mode & self::PROTECT) === self::PROTECT;
if (\is_callable($value)) {
$this->factory = $value;
} else {
if ($this->shared) {
$this->instance = $value;
}
if (\is_object($value)) {
$this->factory = function () use ($value) {
return clone $value;
};
} else {
$this->factory = function () use ($value) {
return $value;
};
}
}
}
/**
* Check whether the resource is shared.
*
* @since 2.0.0
*/
public function isShared(): bool
{
return $this->shared;
}
/**
* Check whether the resource is protected.
*
* @since 2.0.0
*/
public function isProtected(): bool
{
return $this->protected;
}
/**
* Get an instance of the resource.
*
* If a factory was provided, the resource is created and - if it is a shared resource - cached internally.
* If the resource was provided directly, that resource is returned.
*
* @return mixed
*
* @since 2.0.0
*/
public function getInstance()
{
$callable = $this->factory;
if ($this->isShared()) {
if (null === $this->instance) {
$this->instance = $callable($this->container);
}
return $this->instance;
}
return $callable($this->container);
}
/**
* Get the factory.
*
* @since 2.0.0
*/
public function getFactory(): callable
{
return $this->factory;
}
/**
* Reset the resource.
*
* The instance cache is cleared, so that the next call to get() returns a new instance.
* This has an effect on shared, non-protected resources only.
*
* @return bool True if the resource was reset, false otherwise
*
* @since 2.0.0
*/
public function reset(): bool
{
if ($this->isShared() && !$this->isProtected()) {
$this->instance = null;
return \true;
}
return \false;
}
}

View File

@@ -0,0 +1,21 @@
<?php
/**
* Part of the Joomla Framework DI Package.
*
* @copyright Copyright (C) 2013 - 2018 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
namespace _JchOptimizeVendor\Joomla\DI\Exception;
use _JchOptimizeVendor\Psr\Container\ContainerExceptionInterface;
/**
* No container is available.
*
* @since 2.0.0
*/
class ContainerNotFoundException extends \RuntimeException implements ContainerExceptionInterface
{
}

View File

@@ -0,0 +1,21 @@
<?php
/**
* Part of the Joomla Framework DI Package.
*
* @copyright Copyright (C) 2013 - 2018 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
namespace _JchOptimizeVendor\Joomla\DI\Exception;
use _JchOptimizeVendor\Psr\Container\ContainerExceptionInterface;
/**
* Exception class for handling errors in resolving a dependency.
*
* @since 1.0
*/
class DependencyResolutionException extends \RuntimeException implements ContainerExceptionInterface
{
}

View File

@@ -0,0 +1,21 @@
<?php
/**
* Part of the Joomla Framework DI Package.
*
* @copyright Copyright (C) 2013 - 2018 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
namespace _JchOptimizeVendor\Joomla\DI\Exception;
use _JchOptimizeVendor\Psr\Container\NotFoundExceptionInterface;
/**
* No entry was found in the container.
*
* @since 1.5.0
*/
class KeyNotFoundException extends \InvalidArgumentException implements NotFoundExceptionInterface
{
}

View File

@@ -0,0 +1,21 @@
<?php
/**
* Part of the Joomla Framework DI Package.
*
* @copyright Copyright (C) 2013 - 2018 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
namespace _JchOptimizeVendor\Joomla\DI\Exception;
use _JchOptimizeVendor\Psr\Container\ContainerExceptionInterface;
/**
* Attempt to set the value of a protected key, which already is set.
*
* @since 1.5.0
*/
class ProtectedKeyException extends \OutOfBoundsException implements ContainerExceptionInterface
{
}

View File

@@ -0,0 +1,27 @@
<?php
/**
* Part of the Joomla Framework DI Package.
*
* @copyright Copyright (C) 2013 - 2018 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
namespace _JchOptimizeVendor\Joomla\DI;
/**
* Defines the interface for a Service Provider.
*
* @since 1.0
*/
interface ServiceProviderInterface
{
/**
* Registers the service provider with a DI container.
*
* @param Container $container the DI container
*
* @since 1.0
*/
public function register(Container $container);
}

View File

@@ -0,0 +1,340 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.

View File

@@ -0,0 +1,29 @@
<?php
/**
* Part of the Joomla Framework Model Package.
*
* @copyright Copyright (C) 2005 - 2021 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
namespace _JchOptimizeVendor\Joomla\Model;
use Joomla\Database\DatabaseInterface;
/**
* Joomla Framework Database Model Interface.
*
* @since 1.3.0
*/
interface DatabaseModelInterface
{
/**
* Get the database driver.
*
* @return DatabaseInterface the database driver
*
* @since 1.3.0
*/
public function getDb();
}

View File

@@ -0,0 +1,59 @@
<?php
/**
* Part of the Joomla Framework Model Package.
*
* @copyright Copyright (C) 2005 - 2021 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
namespace _JchOptimizeVendor\Joomla\Model;
use Joomla\Database\DatabaseInterface;
/**
* Trait representing a model holding a database reference.
*
* @since 1.3.0
*/
trait DatabaseModelTrait
{
/**
* The database driver.
*
* @var DatabaseInterface
*
* @since 1.3.0
*/
protected $db;
/**
* Get the database driver.
*
* @return DatabaseInterface the database driver
*
* @since 1.3.0
*
* @throws \UnexpectedValueException
*/
public function getDb()
{
if ($this->db) {
return $this->db;
}
throw new \UnexpectedValueException('Database driver not set in '.__CLASS__);
}
/**
* Set the database driver.
*
* @param DatabaseInterface $db the database driver
*
* @since 1.3.0
*/
public function setDb(DatabaseInterface $db)
{
$this->db = $db;
}
}

View File

@@ -0,0 +1,29 @@
<?php
/**
* Part of the Joomla Framework Model Package.
*
* @copyright Copyright (C) 2005 - 2021 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
namespace _JchOptimizeVendor\Joomla\Model;
use Joomla\Registry\Registry;
/**
* Joomla Framework Stateful Model Interface.
*
* @since 1.3.0
*/
interface StatefulModelInterface
{
/**
* Get the model state.
*
* @return Registry the state object
*
* @since 1.3.0
*/
public function getState();
}

View File

@@ -0,0 +1,59 @@
<?php
/**
* Part of the Joomla Framework Model Package.
*
* @copyright Copyright (C) 2005 - 2021 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
namespace _JchOptimizeVendor\Joomla\Model;
use Joomla\Registry\Registry;
/**
* Trait representing a model holding a state.
*
* @since 1.3.0
*/
trait StatefulModelTrait
{
/**
* The model state.
*
* @var Registry
*
* @since 1.3.0
*/
protected $state;
/**
* Get the model state.
*
* @return Registry the state object
*
* @since 1.3.0
*
* @throws \UnexpectedValueException
*/
public function getState()
{
if ($this->state) {
return $this->state;
}
throw new \UnexpectedValueException('State not set in '.__CLASS__);
}
/**
* Set the model state.
*
* @param Registry $state the state object
*
* @since 1.3.0
*/
public function setState(Registry $state)
{
$this->state = $state;
}
}

View File

@@ -0,0 +1,504 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
(This is the first released version of the Lesser GPL. It also counts
as the successor of the GNU Library Public License, version 2, hence
the version number 2.1.)
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
This license, the Lesser General Public License, applies to some
specially designated software packages--typically libraries--of the
Free Software Foundation and other authors who decide to use it. You
can use it too, but we suggest you first think carefully about whether
this license or the ordinary General Public License is the better
strategy to use in any particular case, based on the explanations below.
When we speak of free software, we are referring to freedom of use,
not price. Our General Public Licenses are designed to make sure that
you have the freedom to distribute copies of free software (and charge
for this service if you wish); that you receive source code or can get
it if you want it; that you can change the software and use pieces of
it in new free programs; and that you are informed that you can do
these things.
To protect your rights, we need to make restrictions that forbid
distributors to deny you these rights or to ask you to surrender these
rights. These restrictions translate to certain responsibilities for
you if you distribute copies of the library or if you modify it.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link other code with the library, you must provide
complete object files to the recipients, so that they can relink them
with the library after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
We protect your rights with a two-step method: (1) we copyright the
library, and (2) we offer you this license, which gives you legal
permission to copy, distribute and/or modify the library.
To protect each distributor, we want to make it very clear that
there is no warranty for the free library. Also, if the library is
modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be
introduced by others.
Finally, software patents pose a constant threat to the existence of
any free program. We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
restrictive license from a patent holder. Therefore, we insist that
any patent license obtained for a version of the library must be
consistent with the full freedom of use specified in this license.
Most GNU software, including some libraries, is covered by the
ordinary GNU General Public License. This license, the GNU Lesser
General Public License, applies to certain designated libraries, and
is quite different from the ordinary General Public License. We use
this license for certain libraries in order to permit linking those
libraries into non-free programs.
When a program is linked with a library, whether statically or using
a shared library, the combination of the two is legally speaking a
combined work, a derivative of the original library. The ordinary
General Public License therefore permits such linking only if the
entire combination fits its criteria of freedom. The Lesser General
Public License permits more lax criteria for linking other code with
the library.
We call this license the "Lesser" General Public License because it
does Less to protect the user's freedom than the ordinary General
Public License. It also provides other free software developers Less
of an advantage over competing non-free programs. These disadvantages
are the reason we use the ordinary General Public License for many
libraries. However, the Lesser license provides advantages in certain
special circumstances.
For example, on rare occasions, there may be a special need to
encourage the widest possible use of a certain library, so that it becomes
a de-facto standard. To achieve this, non-free programs must be
allowed to use the library. A more frequent case is that a free
library does the same job as widely used non-free libraries. In this
case, there is little to gain by limiting the free library to free
software only, so we use the Lesser General Public License.
In other cases, permission to use a particular library in non-free
programs enables a greater number of people to use a large body of
free software. For example, permission to use the GNU C Library in
non-free programs enables many more people to use the whole GNU
operating system, as well as its variant, the GNU/Linux operating
system.
Although the Lesser General Public License is Less protective of the
users' freedom, it does ensure that the user of a program that is
linked with the Library has the freedom and the wherewithal to run
that program using a modified version of the Library.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.
GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library or other
program which contains a notice placed by the copyright holder or
other authorized party saying it may be distributed under the terms of
this Lesser General Public License (also called "this License").
Each licensee is addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation
and installation of the library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.
If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
a) Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
b) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (1) uses at run time a
copy of the library already present on the user's computer system,
rather than copying library functions into the executable, and (2)
will operate properly with a modified version of the library, if
the user installs one, as long as the modified version is
interface-compatible with the version that the work was made with.
c) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
d) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
e) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the materials to be distributed need not include anything that is
normally distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.
It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License. However, parties who have received copies,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
9. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties with
this License.
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License may add
an explicit geographical distribution limitation excluding those countries,
so that distribution is permitted only in or among countries not thus
excluded. In such case, this License incorporates the limitation as if
written in the body of this License.
13. The Free Software Foundation may publish revised and/or new
versions of the Lesser General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Library
specifies a version number of this License which applies to it and
"any later version", you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change. You can do so by permitting
redistribution under these terms (or, alternatively, under the terms of the
ordinary General Public License).
To apply these terms, attach the following notices to the library. It is
safest to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
{description}
Copyright (C) {year} {fullname}
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
USA
Also add information on how to contact you by electronic and paper mail.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the library, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
library `Frob' (a library for tweaking knobs) written by James Random
Hacker.
{signature of Ty Coon}, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!

View File

@@ -0,0 +1,74 @@
<?php
/**
* Part of the Joomla Framework Renderer Package.
*
* @copyright Copyright (C) 2005 - 2021 Open Source Matters, Inc. All rights reserved.
* @license http://www.gnu.org/licenses/lgpl-2.1.txt GNU Lesser General Public License Version 2.1 or Later
*/
namespace _JchOptimizeVendor\Joomla\Renderer;
/**
* Abstract class for templates renderer.
*
* @since 2.0.0
*/
abstract class AbstractRenderer implements RendererInterface
{
/**
* Data for output by the renderer.
*
* @var array
*
* @since 2.0.0
*/
protected $data = [];
/**
* Sets a piece of data.
*
* @param string $key Name of variable
* @param string $value Value of variable
*
* @return $this
*
* @since 2.0.0
*/
public function set(string $key, $value)
{
$this->data[$key] = $value;
return $this;
}
/**
* Loads data from array into the renderer.
*
* @param array $data Array of variables
*
* @return $this
*
* @since 2.0.0
*/
public function setData(array $data)
{
$this->data = $data;
return $this;
}
/**
* Unloads data from renderer.
*
* @return $this
*
* @since 2.0.0
*/
public function unsetData()
{
$this->data = [];
return $this;
}
}

View File

@@ -0,0 +1,30 @@
<?php
/**
* Part of the Joomla Framework Renderer Package.
*
* @copyright Copyright (C) 2005 - 2021 Open Source Matters, Inc. All rights reserved.
* @license http://www.gnu.org/licenses/lgpl-2.1.txt GNU Lesser General Public License Version 2.1 or Later
*/
namespace _JchOptimizeVendor\Joomla\Renderer;
/**
* Interface for a renderer which can have template paths added during runtime.
*
* @since 2.0.0
*/
interface AddTemplateFolderInterface
{
/**
* Add a folder with alias to the renderer.
*
* @param string $directory The folder path
* @param string $alias The folder alias
*
* @return $this
*
* @since 2.0.0
*/
public function addFolder(string $directory, string $alias = '');
}

View File

@@ -0,0 +1,116 @@
<?php
/**
* Part of the Joomla Framework Renderer Package.
*
* @copyright Copyright (C) 2005 - 2021 Open Source Matters, Inc. All rights reserved.
* @license http://www.gnu.org/licenses/lgpl-2.1.txt GNU Lesser General Public License Version 2.1 or Later
*/
namespace _JchOptimizeVendor\Joomla\Renderer;
use _JchOptimizeVendor\Illuminate\Contracts\View\Engine;
use _JchOptimizeVendor\Illuminate\Events\Dispatcher;
use _JchOptimizeVendor\Illuminate\Filesystem\Filesystem;
use _JchOptimizeVendor\Illuminate\View\Compilers\BladeCompiler;
use _JchOptimizeVendor\Illuminate\View\Engines\CompilerEngine;
use _JchOptimizeVendor\Illuminate\View\Engines\EngineResolver;
use _JchOptimizeVendor\Illuminate\View\Factory;
use _JchOptimizeVendor\Illuminate\View\FileViewFinder;
/**
* Blade class for rendering output.
*
* @since 2.0.0
*/
class BladeRenderer extends AbstractRenderer implements AddTemplateFolderInterface
{
/**
* Rendering engine.
*
* @var Factory
*
* @since 2.0.0
*/
private $renderer;
/**
* Constructor.
*
* @param Factory $renderer Rendering engine
*
* @since 2.0.0
*/
public function __construct(Factory $renderer = null)
{
if (!$renderer) {
$filesystem = new Filesystem();
$resolver = new EngineResolver();
$resolver->register('blade', static function () use ($filesystem): Engine {
return new CompilerEngine(new BladeCompiler($filesystem));
});
$renderer = new Factory($resolver, new FileViewFinder($filesystem, []), new Dispatcher());
}
$this->renderer = $renderer;
}
/**
* Add a folder with alias to the renderer.
*
* @param string $directory The folder path
* @param string $alias The folder alias (unused)
*
* @return $this
*
* @since 2.0.0
*/
public function addFolder(string $directory, string $alias = '')
{
$this->getRenderer()->addLocation($directory);
return $this;
}
/**
* Get the rendering engine.
*
* @return Factory
*
* @since 2.0.0
*/
public function getRenderer()
{
return $this->renderer;
}
/**
* Checks if folder, folder alias, template or template path exists.
*
* @param string $path Full path or part of a path
*
* @return bool True if the path exists
*
* @since 2.0.0
*/
public function pathExists(string $path): bool
{
return $this->getRenderer()->exists($path);
}
/**
* Render and return compiled data.
*
* @param string $template The template file name
* @param array $data The data to pass to the template
*
* @return string Compiled data
*
* @since 2.0.0
*/
public function render(string $template, array $data = []): string
{
$data = \array_merge($this->data, $data);
return $this->getRenderer()->make($template, $data)->render();
}
}

View File

@@ -0,0 +1,29 @@
<?php
/**
* Part of the Joomla Framework Renderer Package.
*
* @copyright Copyright (C) 2005 - 2021 Open Source Matters, Inc. All rights reserved.
* @license http://www.gnu.org/licenses/lgpl-2.1.txt GNU Lesser General Public License Version 2.1 or Later
*/
namespace _JchOptimizeVendor\Joomla\Renderer;
/**
* Interface defining a renderer with a configurable file extension.
*
* @since 2.0.0
*/
interface ConfigurableFileExtensionInterface
{
/**
* Sets file extension for template loader.
*
* @param string $extension Template files extension
*
* @return $this
*
* @since 2.0.0
*/
public function setFileExtension(string $extension);
}

View File

@@ -0,0 +1,88 @@
<?php
/**
* Part of the Joomla Framework Renderer Package.
*
* @copyright Copyright (C) 2005 - 2021 Open Source Matters, Inc. All rights reserved.
* @license http://www.gnu.org/licenses/lgpl-2.1.txt GNU Lesser General Public License Version 2.1 or Later
*/
namespace _JchOptimizeVendor\Joomla\Renderer;
/**
* Mustache class for rendering output.
*
* @since 2.0.0
*/
class MustacheRenderer extends AbstractRenderer
{
/**
* Rendering engine.
*
* @var \Mustache_Engine
*
* @since 2.0.0
*/
private $renderer;
/**
* Constructor.
*
* @param \Mustache_Engine $renderer Rendering engine
*
* @since 2.0.0
*/
public function __construct(\_JchOptimizeVendor\Mustache_Engine $renderer = null)
{
$this->renderer = $renderer ?: new \_JchOptimizeVendor\Mustache_Engine();
}
/**
* Get the rendering engine.
*
* @return \Mustache_Engine
*
* @since 2.0.0
*/
public function getRenderer()
{
return $this->renderer;
}
/**
* Checks if folder, folder alias, template or template path exists.
*
* @param string $path Full path or part of a path
*
* @return bool True if the path exists
*
* @since 2.0.0
*/
public function pathExists(string $path): bool
{
try {
$this->getRenderer()->getLoader()->load($path);
return \true;
} catch (\_JchOptimizeVendor\Mustache_Exception_UnknownTemplateException $e) {
return \false;
}
}
/**
* Render and return compiled data.
*
* @param string $template The template file name
* @param array $data The data to pass to the template
*
* @return string Compiled data
*
* @since 2.0.0
*/
public function render(string $template, array $data = []): string
{
$data = \array_merge($this->data, $data);
return $this->getRenderer()->render($template, $data);
}
}

View File

@@ -0,0 +1,85 @@
<?php
/**
* Part of the Joomla Framework Renderer Package.
*
* @copyright Copyright (C) 2005 - 2021 Open Source Matters, Inc. All rights reserved.
* @license http://www.gnu.org/licenses/lgpl-2.1.txt GNU Lesser General Public License Version 2.1 or Later
*/
namespace _JchOptimizeVendor\Joomla\Renderer;
use _JchOptimizeVendor\Symfony\Component\Templating\PhpEngine;
use _JchOptimizeVendor\Symfony\Component\Templating\TemplateReferenceInterface;
/**
* PhpEngine template renderer.
*
* @since 2.0.0
*/
class PhpEngineRenderer extends AbstractRenderer
{
/**
* Rendering engine.
*
* @var PhpEngine
*
* @since 2.0.0
*/
private $renderer;
/**
* Constructor.
*
* @param PhpEngine $renderer Rendering engine
*
* @since 2.0.0
*/
public function __construct(PhpEngine $renderer)
{
$this->renderer = $renderer;
}
/**
* Get the rendering engine.
*
* @return PhpEngine
*
* @since 2.0.0
*/
public function getRenderer()
{
return $this->renderer;
}
/**
* Checks if folder, folder alias, template or template path exists.
*
* @param string $path Full path or part of a path
*
* @return bool True if the path exists
*
* @since 2.0.0
*/
public function pathExists(string $path): bool
{
return $this->getRenderer()->exists($path);
}
/**
* Render and return compiled data.
*
* @param string|TemplateReferenceInterface $template A template name or a TemplateReferenceInterface instance
* @param array $data The data to pass to the template
*
* @return string Compiled data
*
* @since 2.0.0
*/
public function render(string $template, array $data = []): string
{
$data = \array_merge($this->data, $data);
return $this->getRenderer()->render($template, $data);
}
}

View File

@@ -0,0 +1,122 @@
<?php
/**
* Part of the Joomla Framework Renderer Package.
*
* @copyright Copyright (C) 2005 - 2021 Open Source Matters, Inc. All rights reserved.
* @license http://www.gnu.org/licenses/lgpl-2.1.txt GNU Lesser General Public License Version 2.1 or Later
*/
namespace _JchOptimizeVendor\Joomla\Renderer;
use _JchOptimizeVendor\League\Plates\Engine;
/**
* Plates class for rendering output.
*
* @since 2.0.0
*/
class PlatesRenderer extends AbstractRenderer implements AddTemplateFolderInterface, ConfigurableFileExtensionInterface
{
/**
* Rendering engine.
*
* @var Engine
*
* @since 2.0.0
*/
private $renderer;
/**
* Constructor.
*
* @param Engine $renderer Rendering engine
*
* @since 2.0.0
*/
public function __construct(Engine $renderer = null)
{
$this->renderer = $renderer ?: new Engine();
}
/**
* Add a folder with alias to the renderer.
*
* @param string $directory The folder path
* @param string $alias The folder alias
*
* @return $this
*
* @since 2.0.0
*
* @throws \InvalidArgumentException
*/
public function addFolder(string $directory, string $alias = '')
{
if ('' === $alias) {
throw new \InvalidArgumentException('Setting an alias is required in Plates');
}
$this->getRenderer()->addFolder($alias, $directory);
return $this;
}
/**
* Get the rendering engine.
*
* @return Engine
*
* @since 2.0.0
*/
public function getRenderer()
{
return $this->renderer;
}
/**
* Checks if folder, folder alias, template or template path exists.
*
* @param string $path Full path or part of a path
*
* @return bool True if the path exists
*
* @since 2.0.0
*/
public function pathExists(string $path): bool
{
return $this->getRenderer()->exists($path);
}
/**
* Render and return compiled data.
*
* @param string $template The template file name
* @param array $data The data to pass to the template
*
* @return string Compiled data
*
* @since 2.0.0
*/
public function render(string $template, array $data = []): string
{
$data = \array_merge($this->data, $data);
return $this->getRenderer()->render($template, $data);
}
/**
* Sets file extension for template loader.
*
* @param string $extension Template files extension
*
* @return $this
*
* @since 2.0.0
*/
public function setFileExtension(string $extension)
{
$this->getRenderer()->setFileExtension($extension);
return $this;
}
}

View File

@@ -0,0 +1,82 @@
<?php
/**
* Part of the Joomla Framework Renderer Package.
*
* @copyright Copyright (C) 2005 - 2021 Open Source Matters, Inc. All rights reserved.
* @license http://www.gnu.org/licenses/lgpl-2.1.txt GNU Lesser General Public License Version 2.1 or Later
*/
namespace _JchOptimizeVendor\Joomla\Renderer;
/**
* Rendering interface.
*
* @since 2.0.0
*/
interface RendererInterface
{
/**
* Checks if folder, folder alias, template or template path exists.
*
* @param string $path Full path or part of a path
*
* @return bool True if the path exists
*
* @since 2.0.0
*/
public function pathExists(string $path): bool;
/**
* Get the rendering engine.
*
* @return mixed
*
* @since 2.0.0
*/
public function getRenderer();
/**
* Render and return compiled data.
*
* @param string $template The template file name
* @param array $data The data to pass to the template
*
* @return string Compiled data
*
* @since 2.0.0
*/
public function render(string $template, array $data = []): string;
/**
* Sets a piece of data.
*
* @param string $key Name of variable
* @param string $value Value of variable
*
* @return $this
*
* @since 2.0.0
*/
public function set(string $key, $value);
/**
* Loads data from array into the renderer.
*
* @param array $data Array of variables
*
* @return $this
*
* @since 2.0.0
*/
public function setData(array $data);
/**
* Unloads data from renderer.
*
* @return $this
*
* @since 2.0.0
*/
public function unsetData();
}

View File

@@ -0,0 +1,121 @@
<?php
/**
* Part of the Joomla Framework Renderer Package.
*
* @copyright Copyright (C) 2005 - 2021 Open Source Matters, Inc. All rights reserved.
* @license http://www.gnu.org/licenses/lgpl-2.1.txt GNU Lesser General Public License Version 2.1 or Later
*/
namespace _JchOptimizeVendor\Joomla\Renderer;
use _JchOptimizeVendor\Twig\Environment;
use _JchOptimizeVendor\Twig\Loader\ExistsLoaderInterface;
use _JchOptimizeVendor\Twig\Loader\FilesystemLoader;
use _JchOptimizeVendor\Twig\Loader\LoaderInterface;
/**
* Twig class for rendering output.
*
* @since 2.0.0
*/
class TwigRenderer extends AbstractRenderer implements AddTemplateFolderInterface
{
/**
* Rendering engine.
*
* @var Environment
*
* @since 2.0.0
*/
private $renderer;
/**
* Constructor.
*
* @param Environment $renderer Rendering engine
*
* @since 2.0.0
*/
public function __construct(Environment $renderer = null)
{
$this->renderer = $renderer ?: new Environment(new FilesystemLoader());
}
/**
* Add a folder with alias to the renderer.
*
* @param string $directory The folder path
* @param string $alias The folder alias
*
* @return $this
*
* @since 2.0.0
*/
public function addFolder(string $directory, string $alias = '')
{
$loader = $this->getRenderer()->getLoader();
// This can only be reliably tested with a loader using the filesystem loader's API
if (\method_exists($loader, 'addPath')) {
if ('' === $alias) {
$alias = FilesystemLoader::MAIN_NAMESPACE;
}
$loader->addPath($directory, $alias);
}
return $this;
}
/**
* Get the rendering engine.
*
* @return Environment
*
* @since 2.0.0
*/
public function getRenderer()
{
return $this->renderer;
}
/**
* Checks if folder, folder alias, template or template path exists.
*
* @param string $path Full path or part of a path
*
* @return bool True if the path exists
*
* @since 2.0.0
*/
public function pathExists(string $path): bool
{
$loader = $this->getRenderer()->getLoader();
/*
* For Twig 1.x compatibility, check if the loader implements ExistsLoaderInterface
* As of Twig 2.0, the `exists()` method is part of LoaderInterface
* This conditional may be removed when dropping Twig 1.x support
*/
if ($loader instanceof ExistsLoaderInterface || \method_exists(LoaderInterface::class, 'exists')) {
return $loader->exists($path);
}
// For all other cases we'll assume the path exists
return \true;
}
/**
* Render and return compiled data.
*
* @param string $template The template file name
* @param array $data The data to pass to the template
*
* @return string Compiled data
*
* @since 2.0.0
*/
public function render(string $template, array $data = []): string
{
$data = \array_merge($this->data, $data);
return $this->getRenderer()->render($template, $data);
}
}

View File

@@ -0,0 +1,340 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.

View File

@@ -0,0 +1,100 @@
<?php
/**
* Part of the Joomla Framework View Package.
*
* @copyright Copyright (C) 2005 - 2021 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
namespace _JchOptimizeVendor\Joomla\View;
/**
* Joomla Framework Abstract View Class.
*
* @since 1.0
*/
abstract class AbstractView implements ViewInterface
{
/**
* The data array to pass to the renderer.
*
* @var array
*
* @since 2.0.0
*/
private $data = [];
/**
* Adds an object to the data array.
*
* @param string $key The array key
* @param mixed $value The data value to add
*
* @return $this
*
* @since 2.0.0
*/
public function addData(string $key, $value)
{
$this->data[$key] = $value;
return $this;
}
/**
* Resets the internal data array.
*
* @return $this
*
* @since 2.0.0
*/
public function clearData()
{
$this->data = [];
return $this;
}
/**
* Retrieves the data array.
*
* @since 2.0.0
*/
public function getData(): array
{
return $this->data;
}
/**
* Removes an object to the data array.
*
* @param string $key The array key to remove
*
* @return $this
*
* @since 2.0.0
*/
public function removeData(string $key)
{
unset($this->data[$key]);
return $this;
}
/**
* Sets additional data to the data array.
*
* @param array $data Data to merge into the existing data array
*
* @return $this
*
* @since 2.0.0
*/
public function setData(array $data)
{
$this->data = \array_merge($this->data, $data);
return $this;
}
}

View File

@@ -0,0 +1,132 @@
<?php
/**
* Part of the Joomla Framework View Package.
*
* @copyright Copyright (C) 2005 - 2021 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
namespace _JchOptimizeVendor\Joomla\View;
use _JchOptimizeVendor\Joomla\Renderer\RendererInterface;
/**
* Joomla Framework HTML View Class.
*
* @since 2.0.0
*/
class HtmlView extends AbstractView
{
/**
* The view layout.
*
* @var string
*
* @since 2.0.0
*/
protected $layout = 'default';
/**
* The renderer object.
*
* @var RendererInterface
*
* @since 2.0.0
*/
private $renderer;
/**
* Method to instantiate the view.
*
* @param RendererInterface $renderer the renderer object
*
* @since 2.0.0
*/
public function __construct(RendererInterface $renderer)
{
$this->setRenderer($renderer);
}
/**
* Magic toString method that is a proxy for the render method.
*
* @return string
*
* @since 2.0.0
*/
public function __toString()
{
try {
return $this->render();
} catch (\Exception $e) {
return $e->getMessage();
}
}
/**
* Method to get the view layout.
*
* @return string the layout name
*
* @since 2.0.0
*/
public function getLayout(): string
{
return $this->layout;
}
/**
* Retrieves the renderer object.
*
* @since 2.0.0
*/
public function getRenderer(): RendererInterface
{
return $this->renderer;
}
/**
* Method to render the view.
*
* @return string the rendered view
*
* @since 2.0.0
*/
public function render()
{
return $this->getRenderer()->render($this->getLayout(), $this->getData());
}
/**
* Method to set the view layout.
*
* @param string $layout the layout name
*
* @return $this
*
* @since 2.0.0
*/
public function setLayout(string $layout)
{
$this->layout = $layout;
return $this;
}
/**
* Sets the renderer object.
*
* @param RendererInterface $renderer the renderer object
*
* @return $this
*
* @since 2.0.0
*/
public function setRenderer(RendererInterface $renderer)
{
$this->renderer = $renderer;
return $this;
}
}

View File

@@ -0,0 +1,30 @@
<?php
/**
* Part of the Joomla Framework View Package.
*
* @copyright Copyright (C) 2005 - 2021 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
namespace _JchOptimizeVendor\Joomla\View;
/**
* Joomla Framework JSON View Class.
*
* @since 2.0.0
*/
class JsonView extends AbstractView
{
/**
* Method to render the view.
*
* @return string the rendered view
*
* @since 2.0.0
*/
public function render()
{
return \json_encode($this->getData());
}
}

View File

@@ -0,0 +1,29 @@
<?php
/**
* Part of the Joomla Framework View Package.
*
* @copyright Copyright (C) 2005 - 2021 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
namespace _JchOptimizeVendor\Joomla\View;
/**
* Joomla Framework View Interface.
*
* @since 1.0
*/
interface ViewInterface
{
/**
* Method to render the view.
*
* @return string the rendered view
*
* @since 1.0
*
* @throws \RuntimeException
*/
public function render();
}