first commit
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
|
50
bot.php
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
<?php
|
||||||
|
include __DIR__.'/vendor/autoload.php';
|
||||||
|
|
||||||
|
use Discord\Discord;
|
||||||
|
use Discord\Parts\Channel\Message;
|
||||||
|
use Discord\WebSockets\Intents;
|
||||||
|
use Discord\WebSockets\Event;
|
||||||
|
use Discord\Parts\Interactions\Command\Command; // Please note to use this correct namespace!
|
||||||
|
use Discord\Parts\Interactions\Interaction;
|
||||||
|
use Discord\Builders\MessageBuilder;
|
||||||
|
|
||||||
|
$discord = new Discord([
|
||||||
|
'token' => 'MTMyNjQzMTc1MjIzNDczMzY0OQ.GD846-.Mfl6iv39czVqdIVuS3nFxClDD9zymEvndti5-U',
|
||||||
|
'intents' => Intents::getDefaultIntents()
|
||||||
|
]);
|
||||||
|
|
||||||
|
$discord->on('init', function (Discord $discord) {
|
||||||
|
$infoVehiculCommand = new Command($discord, [
|
||||||
|
'name' => 'infovehicul',
|
||||||
|
'description' => 'Informatii despre vehicule cu sistem APC',
|
||||||
|
'options' => [
|
||||||
|
[
|
||||||
|
'name' => 'numarparc',
|
||||||
|
'description' => 'Numarul de parc al vehicului',
|
||||||
|
'type' => 4,
|
||||||
|
'required' => true
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]);
|
||||||
|
$pozitieCommand = new Command($discord, [
|
||||||
|
'name' => 'pozitie',
|
||||||
|
'description' => 'Pozitia unui vehicul.',
|
||||||
|
'options' => [
|
||||||
|
[
|
||||||
|
'name' => 'inmatriculare',
|
||||||
|
'description' => 'Numarul de inmatriculare',
|
||||||
|
'type' => 3,
|
||||||
|
'required' => true
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]);
|
||||||
|
$discord->application->commands->save($infoVehiculCommand);
|
||||||
|
$discord->application->commands->save($pozitieCommand);
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
require("./commands/infovehicul.php");
|
||||||
|
require("./commands/pozitie.php");
|
||||||
|
|
||||||
|
$discord->run();
|
63
commands/infovehicul.php
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
<?php
|
||||||
|
use Discord\Discord;
|
||||||
|
use Discord\Parts\Channel\Message;
|
||||||
|
use Discord\WebSockets\Event;
|
||||||
|
use Discord\Parts\Interactions\Command\Command;
|
||||||
|
use Discord\Parts\Interactions\Interaction;
|
||||||
|
use Discord\Builders\MessageBuilder;
|
||||||
|
|
||||||
|
$discord->listenCommand('infovehicul', function (Interaction $interaction) {
|
||||||
|
$options = $interaction->data->options;
|
||||||
|
$parc = $options['numarparc']->value;
|
||||||
|
|
||||||
|
$client = new \GuzzleHttp\Client();
|
||||||
|
$request = $client->request('GET', 'https://maps.mo-bi.ro/api/passenger-data');
|
||||||
|
if ($request->getStatusCode() !== 200) {
|
||||||
|
$interaction->respondWithMessage(
|
||||||
|
MessageBuilder::new()->setContent(
|
||||||
|
'OOPSIE WOOPSIE!! Uwu We made a fucky wucky!! A wittle fucko boingo! The code monkeys at our headquarters are working VEWY HAWD to fix this'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
$response = json_decode($request->getBody(), true);
|
||||||
|
$vehicle = null;
|
||||||
|
|
||||||
|
foreach ($response as $v) {
|
||||||
|
if ($v['vehicle_id'] == $parc) {
|
||||||
|
$vehicle = $v;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$vehicle) {
|
||||||
|
$interaction->respondWithMessage(
|
||||||
|
MessageBuilder::new()->setContent(
|
||||||
|
'Vehiculul nu a putut fi gasit. Tineti cont ca doar vehiculele achizitionate dupa 2018 merg cu aceasta comanda.'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
$destination = $vehicle['destination'] ?? "N/A";
|
||||||
|
$peopleOnBoard = $vehicle['people_on_board'] ?? "Unknown";
|
||||||
|
|
||||||
|
$interactionResponse = "__**" . $parc . "** " . $destination . "__\nOameni in vehicul: " . $peopleOnBoard . "\n\n";
|
||||||
|
|
||||||
|
$crt = 1;
|
||||||
|
foreach ($vehicle['apc_sensors'] as $sensor) {
|
||||||
|
if ($sensor["device_online"]) {
|
||||||
|
$door = "Nu";
|
||||||
|
if ($sensor['door_open']) {
|
||||||
|
$door = "Da";
|
||||||
|
}
|
||||||
|
$interactionResponse = $interactionResponse . "**Senzor " . $crt . "**: Usa deschisa? " . $door . " // Intrari: " . $sensor['entries'] . " // Iesiri: " . $sensor['exits'] . "\n";
|
||||||
|
$crt++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$interaction->respondWithMessage(
|
||||||
|
MessageBuilder::new()->setContent($interactionResponse)
|
||||||
|
);
|
||||||
|
});
|
||||||
|
?>
|
58
commands/pozitie.php
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
<?php
|
||||||
|
use Discord\Discord;
|
||||||
|
use Discord\Parts\Channel\Message;
|
||||||
|
use Discord\WebSockets\Event;
|
||||||
|
use Discord\Parts\Interactions\Command\Command;
|
||||||
|
use Discord\Parts\Interactions\Interaction;
|
||||||
|
use Discord\Builders\MessageBuilder;
|
||||||
|
|
||||||
|
use \DantSu\OpenStreetMapStaticAPI\OpenStreetMap;
|
||||||
|
use \DantSu\OpenStreetMapStaticAPI\LatLng;
|
||||||
|
use \DantSu\OpenStreetMapStaticAPI\Polygon;
|
||||||
|
use \DantSu\OpenStreetMapStaticAPI\Markers;
|
||||||
|
|
||||||
|
$discord->listenCommand('pozitie', function (Interaction $interaction) {
|
||||||
|
$options = $interaction->data->options;
|
||||||
|
$inmatriculare = $options['inmatriculare']->value;
|
||||||
|
|
||||||
|
$client = new \GuzzleHttp\Client();
|
||||||
|
$request = $client->request('GET', 'https://maps.mo-bi.ro/api/busData');
|
||||||
|
if ($request->getStatusCode() !== 200) {
|
||||||
|
$interaction->respondWithMessage(
|
||||||
|
MessageBuilder::new()->setContent(
|
||||||
|
'OOPSIE WOOPSIE!! Uwu We made a fucky wucky!! A wittle fucko boingo! The code monkeys at our headquarters are working VEWY HAWD to fix this'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
$response = json_decode($request->getBody(), true);
|
||||||
|
$vehicle = null;
|
||||||
|
|
||||||
|
foreach ($response as $v) {
|
||||||
|
if ($v['vehicle']['vehicle']['licensePlate'] == $inmatriculare) {
|
||||||
|
$vehicle = $v;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$vehicle) {
|
||||||
|
$interaction->respondWithMessage(MessageBuilder::new()->setContent('Vehiculul nu a putut fi gasit.'));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
$latitude = $vehicle['vehicle']['position']['latitude'];
|
||||||
|
$longitude = $vehicle['vehicle']['position']['longitude'];
|
||||||
|
|
||||||
|
(new OpenStreetMap(new LatLng($vehicle['vehicle']['position']['latitude'], $vehicle['vehicle']['position']['longitude']), 16, 600, 300))
|
||||||
|
->addMarkers(
|
||||||
|
(new Markers(__DIR__ . '/../resources/marker.png'))
|
||||||
|
->setAnchor(Markers::ANCHOR_CENTER, Markers::ANCHOR_BOTTOM)
|
||||||
|
->addMarker(new LatLng($vehicle['vehicle']['position']['latitude'], $vehicle['vehicle']['position']['longitude']))
|
||||||
|
)
|
||||||
|
->GetImage()
|
||||||
|
->saveJPG(__DIR__ . '/../pozitie.jpg', 70);
|
||||||
|
|
||||||
|
$interaction->respondWithMessage(MessageBuilder::new()->addFile(__DIR__ . '/../pozitie.jpg'));
|
||||||
|
});
|
||||||
|
?>
|
8
composer.json
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"require": {
|
||||||
|
"team-reflex/discord-php": "^10.1",
|
||||||
|
"dantsu/php-osm-static-api": "^0.6.4",
|
||||||
|
"dantsu/php-image-editor": "^1.4",
|
||||||
|
"guzzlehttp/guzzle": "^7.9"
|
||||||
|
}
|
||||||
|
}
|
2862
composer.lock
generated
Normal file
190
license.txt
Normal file
@ -0,0 +1,190 @@
|
|||||||
|
|
||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
|
||||||
|
Version 3, 29 June 2007
|
||||||
|
|
||||||
|
Copyright © 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||||
|
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The GNU General Public License is a free, copyleft license for software and other kinds of works.
|
||||||
|
|
||||||
|
The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. 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 them 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 prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others.
|
||||||
|
|
||||||
|
For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. 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.
|
||||||
|
|
||||||
|
Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it.
|
||||||
|
|
||||||
|
For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions.
|
||||||
|
|
||||||
|
Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users.
|
||||||
|
|
||||||
|
Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and modification follow.
|
||||||
|
TERMS AND CONDITIONS
|
||||||
|
0. Definitions.
|
||||||
|
|
||||||
|
“This License” refers to version 3 of the GNU General Public License.
|
||||||
|
|
||||||
|
“Copyright” also means copyright-like laws that apply to other kinds of works, such as semiconductor masks.
|
||||||
|
|
||||||
|
“The Program” refers to any copyrightable work licensed under this License. Each licensee is addressed as “you”. “Licensees” and “recipients” may be individuals or organizations.
|
||||||
|
|
||||||
|
To “modify” a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a “modified version” of the earlier work or a work “based on” the earlier work.
|
||||||
|
|
||||||
|
A “covered work” means either the unmodified Program or a work based on the Program.
|
||||||
|
|
||||||
|
To “propagate” a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well.
|
||||||
|
|
||||||
|
To “convey” a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying.
|
||||||
|
|
||||||
|
An interactive user interface displays “Appropriate Legal Notices” to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion.
|
||||||
|
1. Source Code.
|
||||||
|
|
||||||
|
The “source code” for a work means the preferred form of the work for making modifications to it. “Object code” means any non-source form of a work.
|
||||||
|
|
||||||
|
A “Standard Interface” means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language.
|
||||||
|
|
||||||
|
The “System Libraries” of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A “Major Component”, in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it.
|
||||||
|
|
||||||
|
The “Corresponding Source” for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work.
|
||||||
|
|
||||||
|
The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source.
|
||||||
|
|
||||||
|
The Corresponding Source for a work in source code form is that same work.
|
||||||
|
2. Basic Permissions.
|
||||||
|
|
||||||
|
All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law.
|
||||||
|
|
||||||
|
You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you.
|
||||||
|
|
||||||
|
Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary.
|
||||||
|
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||||
|
|
||||||
|
No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures.
|
||||||
|
|
||||||
|
When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures.
|
||||||
|
4. Conveying Verbatim Copies.
|
||||||
|
|
||||||
|
You may convey 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; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program.
|
||||||
|
|
||||||
|
You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee.
|
||||||
|
5. Conveying Modified Source Versions.
|
||||||
|
|
||||||
|
You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) The work must carry prominent notices stating that you modified it, and giving a relevant date.
|
||||||
|
b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to “keep intact all notices”.
|
||||||
|
c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it.
|
||||||
|
d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so.
|
||||||
|
|
||||||
|
A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an “aggregate” if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate.
|
||||||
|
6. Conveying Non-Source Forms.
|
||||||
|
|
||||||
|
You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways:
|
||||||
|
|
||||||
|
a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange.
|
||||||
|
b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge.
|
||||||
|
c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b.
|
||||||
|
d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements.
|
||||||
|
e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d.
|
||||||
|
|
||||||
|
A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work.
|
||||||
|
|
||||||
|
A “User Product” is either (1) a “consumer product”, which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, “normally used” refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product.
|
||||||
|
|
||||||
|
“Installation Information” for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made.
|
||||||
|
|
||||||
|
If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM).
|
||||||
|
|
||||||
|
The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network.
|
||||||
|
|
||||||
|
Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying.
|
||||||
|
7. Additional Terms.
|
||||||
|
|
||||||
|
“Additional permissions” are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions.
|
||||||
|
|
||||||
|
When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms:
|
||||||
|
|
||||||
|
a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or
|
||||||
|
b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or
|
||||||
|
c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or
|
||||||
|
d) Limiting the use for publicity purposes of names of licensors or authors of the material; or
|
||||||
|
e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or
|
||||||
|
f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors.
|
||||||
|
|
||||||
|
All other non-permissive additional terms are considered “further restrictions” within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying.
|
||||||
|
|
||||||
|
If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms.
|
||||||
|
|
||||||
|
Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way.
|
||||||
|
8. Termination.
|
||||||
|
|
||||||
|
You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11).
|
||||||
|
|
||||||
|
However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation.
|
||||||
|
|
||||||
|
Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice.
|
||||||
|
|
||||||
|
Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10.
|
||||||
|
9. Acceptance Not Required for Having Copies.
|
||||||
|
|
||||||
|
You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so.
|
||||||
|
10. Automatic Licensing of Downstream Recipients.
|
||||||
|
|
||||||
|
Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License.
|
||||||
|
|
||||||
|
An “entity transaction” is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts.
|
||||||
|
|
||||||
|
You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it.
|
||||||
|
11. Patents.
|
||||||
|
|
||||||
|
A “contributor” is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's “contributor version”.
|
||||||
|
|
||||||
|
A contributor's “essential patent claims” are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, “control” includes the right to grant patent sublicenses in a manner consistent with the requirements of this License.
|
||||||
|
|
||||||
|
Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version.
|
||||||
|
|
||||||
|
In the following three paragraphs, a “patent license” is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To “grant” such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party.
|
||||||
|
|
||||||
|
If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. “Knowingly relying” means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid.
|
||||||
|
|
||||||
|
If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it.
|
||||||
|
|
||||||
|
A patent license is “discriminatory” if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007.
|
||||||
|
|
||||||
|
Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law.
|
||||||
|
12. No Surrender of Others' Freedom.
|
||||||
|
|
||||||
|
If 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 convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program.
|
||||||
|
13. Use with the GNU Affero General Public License.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such.
|
||||||
|
14. Revised Versions of this License.
|
||||||
|
|
||||||
|
The Free Software Foundation may publish revised and/or new versions of the GNU 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 that a certain numbered version of the GNU General Public License “or any later version” applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation.
|
||||||
|
|
||||||
|
If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program.
|
||||||
|
|
||||||
|
Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version.
|
||||||
|
15. Disclaimer of Warranty.
|
||||||
|
|
||||||
|
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.
|
||||||
|
16. Limitation of Liability.
|
||||||
|
|
||||||
|
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 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.
|
||||||
|
17. Interpretation of Sections 15 and 16.
|
||||||
|
|
||||||
|
If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
BIN
pozitie.jpg
Normal file
After Width: | Height: | Size: 37 KiB |
BIN
resources/marker.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
25
vendor/autoload.php
vendored
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
// autoload.php @generated by Composer
|
||||||
|
|
||||||
|
if (PHP_VERSION_ID < 50600) {
|
||||||
|
if (!headers_sent()) {
|
||||||
|
header('HTTP/1.1 500 Internal Server Error');
|
||||||
|
}
|
||||||
|
$err = 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
|
||||||
|
if (!ini_get('display_errors')) {
|
||||||
|
if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
|
||||||
|
fwrite(STDERR, $err);
|
||||||
|
} elseif (!headers_sent()) {
|
||||||
|
echo $err;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
trigger_error(
|
||||||
|
$err,
|
||||||
|
E_USER_ERROR
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
require_once __DIR__ . '/composer/autoload_real.php';
|
||||||
|
|
||||||
|
return ComposerAutoloaderInit39e76b5f4d8c6722589be79886dc5716::getLoader();
|
119
vendor/bin/carbon
vendored
Executable file
@ -0,0 +1,119 @@
|
|||||||
|
#!/usr/bin/env php
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Proxy PHP file generated by Composer
|
||||||
|
*
|
||||||
|
* This file includes the referenced bin path (../nesbot/carbon/bin/carbon)
|
||||||
|
* using a stream wrapper to prevent the shebang from being output on PHP<8
|
||||||
|
*
|
||||||
|
* @generated
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Composer;
|
||||||
|
|
||||||
|
$GLOBALS['_composer_bin_dir'] = __DIR__;
|
||||||
|
$GLOBALS['_composer_autoload_path'] = __DIR__ . '/..'.'/autoload.php';
|
||||||
|
|
||||||
|
if (PHP_VERSION_ID < 80000) {
|
||||||
|
if (!class_exists('Composer\BinProxyWrapper')) {
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
final class BinProxyWrapper
|
||||||
|
{
|
||||||
|
private $handle;
|
||||||
|
private $position;
|
||||||
|
private $realpath;
|
||||||
|
|
||||||
|
public function stream_open($path, $mode, $options, &$opened_path)
|
||||||
|
{
|
||||||
|
// get rid of phpvfscomposer:// prefix for __FILE__ & __DIR__ resolution
|
||||||
|
$opened_path = substr($path, 17);
|
||||||
|
$this->realpath = realpath($opened_path) ?: $opened_path;
|
||||||
|
$opened_path = $this->realpath;
|
||||||
|
$this->handle = fopen($this->realpath, $mode);
|
||||||
|
$this->position = 0;
|
||||||
|
|
||||||
|
return (bool) $this->handle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function stream_read($count)
|
||||||
|
{
|
||||||
|
$data = fread($this->handle, $count);
|
||||||
|
|
||||||
|
if ($this->position === 0) {
|
||||||
|
$data = preg_replace('{^#!.*\r?\n}', '', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->position += strlen($data);
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function stream_cast($castAs)
|
||||||
|
{
|
||||||
|
return $this->handle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function stream_close()
|
||||||
|
{
|
||||||
|
fclose($this->handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function stream_lock($operation)
|
||||||
|
{
|
||||||
|
return $operation ? flock($this->handle, $operation) : true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function stream_seek($offset, $whence)
|
||||||
|
{
|
||||||
|
if (0 === fseek($this->handle, $offset, $whence)) {
|
||||||
|
$this->position = ftell($this->handle);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function stream_tell()
|
||||||
|
{
|
||||||
|
return $this->position;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function stream_eof()
|
||||||
|
{
|
||||||
|
return feof($this->handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function stream_stat()
|
||||||
|
{
|
||||||
|
return array();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function stream_set_option($option, $arg1, $arg2)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function url_stat($path, $flags)
|
||||||
|
{
|
||||||
|
$path = substr($path, 17);
|
||||||
|
if (file_exists($path)) {
|
||||||
|
return stat($path);
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
(function_exists('stream_get_wrappers') && in_array('phpvfscomposer', stream_get_wrappers(), true))
|
||||||
|
|| (function_exists('stream_wrapper_register') && stream_wrapper_register('phpvfscomposer', 'Composer\BinProxyWrapper'))
|
||||||
|
) {
|
||||||
|
return include("phpvfscomposer://" . __DIR__ . '/..'.'/nesbot/carbon/bin/carbon');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return include __DIR__ . '/..'.'/nesbot/carbon/bin/carbon';
|
21
vendor/carbonphp/carbon-doctrine-types/LICENSE
vendored
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2023 Carbon
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
14
vendor/carbonphp/carbon-doctrine-types/README.md
vendored
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
# carbonphp/carbon-doctrine-types
|
||||||
|
|
||||||
|
Types to use Carbon in Doctrine
|
||||||
|
|
||||||
|
## Documentation
|
||||||
|
|
||||||
|
[Check how to use in the official Carbon documentation](https://carbon.nesbot.com/symfony/)
|
||||||
|
|
||||||
|
This package is an externalization of [src/Carbon/Doctrine](https://github.com/briannesbitt/Carbon/tree/2.71.0/src/Carbon/Doctrine)
|
||||||
|
from `nestbot/carbon` package.
|
||||||
|
|
||||||
|
Externalization allows to better deal with different versions of dbal. With
|
||||||
|
version 4.0 of dbal, it no longer sustainable to be compatible with all version
|
||||||
|
using a single code.
|
36
vendor/carbonphp/carbon-doctrine-types/composer.json
vendored
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
{
|
||||||
|
"name": "carbonphp/carbon-doctrine-types",
|
||||||
|
"description": "Types to use Carbon in Doctrine",
|
||||||
|
"type": "library",
|
||||||
|
"keywords": [
|
||||||
|
"date",
|
||||||
|
"time",
|
||||||
|
"DateTime",
|
||||||
|
"Carbon",
|
||||||
|
"Doctrine"
|
||||||
|
],
|
||||||
|
"require": {
|
||||||
|
"php": "^8.1"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"doctrine/dbal": "^4.0.0",
|
||||||
|
"nesbot/carbon": "^2.71.0 || ^3.0.0",
|
||||||
|
"phpunit/phpunit": "^10.3"
|
||||||
|
},
|
||||||
|
"conflict": {
|
||||||
|
"doctrine/dbal": "<4.0.0 || >=5.0.0"
|
||||||
|
},
|
||||||
|
"license": "MIT",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Carbon\\Doctrine\\": "src/Carbon/Doctrine/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "KyleKatarn",
|
||||||
|
"email": "kylekatarnls@gmail.com"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"minimum-stability": "dev"
|
||||||
|
}
|
16
vendor/carbonphp/carbon-doctrine-types/src/Carbon/Doctrine/CarbonDoctrineType.php
vendored
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Carbon\Doctrine;
|
||||||
|
|
||||||
|
use Doctrine\DBAL\Platforms\AbstractPlatform;
|
||||||
|
|
||||||
|
interface CarbonDoctrineType
|
||||||
|
{
|
||||||
|
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform);
|
||||||
|
|
||||||
|
public function convertToPHPValue(mixed $value, AbstractPlatform $platform);
|
||||||
|
|
||||||
|
public function convertToDatabaseValue($value, AbstractPlatform $platform);
|
||||||
|
}
|
9
vendor/carbonphp/carbon-doctrine-types/src/Carbon/Doctrine/CarbonImmutableType.php
vendored
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Carbon\Doctrine;
|
||||||
|
|
||||||
|
class CarbonImmutableType extends DateTimeImmutableType implements CarbonDoctrineType
|
||||||
|
{
|
||||||
|
}
|
9
vendor/carbonphp/carbon-doctrine-types/src/Carbon/Doctrine/CarbonType.php
vendored
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Carbon\Doctrine;
|
||||||
|
|
||||||
|
class CarbonType extends DateTimeType implements CarbonDoctrineType
|
||||||
|
{
|
||||||
|
}
|
131
vendor/carbonphp/carbon-doctrine-types/src/Carbon/Doctrine/CarbonTypeConverter.php
vendored
Normal file
@ -0,0 +1,131 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Carbon\Doctrine;
|
||||||
|
|
||||||
|
use Carbon\Carbon;
|
||||||
|
use Carbon\CarbonInterface;
|
||||||
|
use DateTimeInterface;
|
||||||
|
use Doctrine\DBAL\Platforms\AbstractPlatform;
|
||||||
|
use Doctrine\DBAL\Platforms\DB2Platform;
|
||||||
|
use Doctrine\DBAL\Platforms\OraclePlatform;
|
||||||
|
use Doctrine\DBAL\Platforms\SQLitePlatform;
|
||||||
|
use Doctrine\DBAL\Platforms\SQLServerPlatform;
|
||||||
|
use Doctrine\DBAL\Types\Exception\InvalidType;
|
||||||
|
use Doctrine\DBAL\Types\Exception\ValueNotConvertible;
|
||||||
|
use Exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @template T of CarbonInterface
|
||||||
|
*/
|
||||||
|
trait CarbonTypeConverter
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* This property differentiates types installed by carbonphp/carbon-doctrine-types
|
||||||
|
* from the ones embedded previously in nesbot/carbon source directly.
|
||||||
|
*
|
||||||
|
* @readonly
|
||||||
|
*/
|
||||||
|
public bool $external = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return class-string<T>
|
||||||
|
*/
|
||||||
|
protected function getCarbonClassName(): string
|
||||||
|
{
|
||||||
|
return Carbon::class;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform): string
|
||||||
|
{
|
||||||
|
$precision = min(
|
||||||
|
$fieldDeclaration['precision'] ?? DateTimeDefaultPrecision::get(),
|
||||||
|
$this->getMaximumPrecision($platform),
|
||||||
|
);
|
||||||
|
|
||||||
|
$type = parent::getSQLDeclaration($fieldDeclaration, $platform);
|
||||||
|
|
||||||
|
if (!$precision) {
|
||||||
|
return $type;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (str_contains($type, '(')) {
|
||||||
|
return preg_replace('/\(\d+\)/', "($precision)", $type);
|
||||||
|
}
|
||||||
|
|
||||||
|
[$before, $after] = explode(' ', "$type ");
|
||||||
|
|
||||||
|
return trim("$before($precision) $after");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||||
|
*/
|
||||||
|
public function convertToDatabaseValue($value, AbstractPlatform $platform): ?string
|
||||||
|
{
|
||||||
|
if ($value === null) {
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($value instanceof DateTimeInterface) {
|
||||||
|
return $value->format('Y-m-d H:i:s.u');
|
||||||
|
}
|
||||||
|
|
||||||
|
throw InvalidType::new(
|
||||||
|
$value,
|
||||||
|
static::class,
|
||||||
|
['null', 'DateTime', 'Carbon']
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function doConvertToPHPValue(mixed $value)
|
||||||
|
{
|
||||||
|
$class = $this->getCarbonClassName();
|
||||||
|
|
||||||
|
if ($value === null || is_a($value, $class)) {
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($value instanceof DateTimeInterface) {
|
||||||
|
return $class::instance($value);
|
||||||
|
}
|
||||||
|
|
||||||
|
$date = null;
|
||||||
|
$error = null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
$date = $class::parse($value);
|
||||||
|
} catch (Exception $exception) {
|
||||||
|
$error = $exception;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$date) {
|
||||||
|
throw ValueNotConvertible::new(
|
||||||
|
$value,
|
||||||
|
static::class,
|
||||||
|
'Y-m-d H:i:s.u or any format supported by '.$class.'::parse()',
|
||||||
|
$error
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $date;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getMaximumPrecision(AbstractPlatform $platform): int
|
||||||
|
{
|
||||||
|
if ($platform instanceof DB2Platform) {
|
||||||
|
return 12;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($platform instanceof OraclePlatform) {
|
||||||
|
return 9;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($platform instanceof SQLServerPlatform || $platform instanceof SQLitePlatform) {
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 6;
|
||||||
|
}
|
||||||
|
}
|
30
vendor/carbonphp/carbon-doctrine-types/src/Carbon/Doctrine/DateTimeDefaultPrecision.php
vendored
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Carbon\Doctrine;
|
||||||
|
|
||||||
|
class DateTimeDefaultPrecision
|
||||||
|
{
|
||||||
|
private static $precision = 6;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Change the default Doctrine datetime and datetime_immutable precision.
|
||||||
|
*
|
||||||
|
* @param int $precision
|
||||||
|
*/
|
||||||
|
public static function set(int $precision): void
|
||||||
|
{
|
||||||
|
self::$precision = $precision;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the default Doctrine datetime and datetime_immutable precision.
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public static function get(): int
|
||||||
|
{
|
||||||
|
return self::$precision;
|
||||||
|
}
|
||||||
|
}
|
32
vendor/carbonphp/carbon-doctrine-types/src/Carbon/Doctrine/DateTimeImmutableType.php
vendored
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Carbon\Doctrine;
|
||||||
|
|
||||||
|
use Carbon\CarbonImmutable;
|
||||||
|
use DateTimeImmutable;
|
||||||
|
use Doctrine\DBAL\Platforms\AbstractPlatform;
|
||||||
|
use Doctrine\DBAL\Types\VarDateTimeImmutableType;
|
||||||
|
|
||||||
|
class DateTimeImmutableType extends VarDateTimeImmutableType implements CarbonDoctrineType
|
||||||
|
{
|
||||||
|
/** @use CarbonTypeConverter<CarbonImmutable> */
|
||||||
|
use CarbonTypeConverter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||||
|
*/
|
||||||
|
public function convertToPHPValue(mixed $value, AbstractPlatform $platform): ?CarbonImmutable
|
||||||
|
{
|
||||||
|
return $this->doConvertToPHPValue($value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return class-string<CarbonImmutable>
|
||||||
|
*/
|
||||||
|
protected function getCarbonClassName(): string
|
||||||
|
{
|
||||||
|
return CarbonImmutable::class;
|
||||||
|
}
|
||||||
|
}
|
24
vendor/carbonphp/carbon-doctrine-types/src/Carbon/Doctrine/DateTimeType.php
vendored
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Carbon\Doctrine;
|
||||||
|
|
||||||
|
use Carbon\Carbon;
|
||||||
|
use DateTime;
|
||||||
|
use Doctrine\DBAL\Platforms\AbstractPlatform;
|
||||||
|
use Doctrine\DBAL\Types\VarDateTimeType;
|
||||||
|
|
||||||
|
class DateTimeType extends VarDateTimeType implements CarbonDoctrineType
|
||||||
|
{
|
||||||
|
/** @use CarbonTypeConverter<Carbon> */
|
||||||
|
use CarbonTypeConverter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||||
|
*/
|
||||||
|
public function convertToPHPValue(mixed $value, AbstractPlatform $platform): ?Carbon
|
||||||
|
{
|
||||||
|
return $this->doConvertToPHPValue($value);
|
||||||
|
}
|
||||||
|
}
|
579
vendor/composer/ClassLoader.php
vendored
Normal file
@ -0,0 +1,579 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of Composer.
|
||||||
|
*
|
||||||
|
* (c) Nils Adermann <naderman@naderman.de>
|
||||||
|
* Jordi Boggiano <j.boggiano@seld.be>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Composer\Autoload;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
|
||||||
|
*
|
||||||
|
* $loader = new \Composer\Autoload\ClassLoader();
|
||||||
|
*
|
||||||
|
* // register classes with namespaces
|
||||||
|
* $loader->add('Symfony\Component', __DIR__.'/component');
|
||||||
|
* $loader->add('Symfony', __DIR__.'/framework');
|
||||||
|
*
|
||||||
|
* // activate the autoloader
|
||||||
|
* $loader->register();
|
||||||
|
*
|
||||||
|
* // to enable searching the include path (eg. for PEAR packages)
|
||||||
|
* $loader->setUseIncludePath(true);
|
||||||
|
*
|
||||||
|
* In this example, if you try to use a class in the Symfony\Component
|
||||||
|
* namespace or one of its children (Symfony\Component\Console for instance),
|
||||||
|
* the autoloader will first look for the class under the component/
|
||||||
|
* directory, and it will then fallback to the framework/ directory if not
|
||||||
|
* found before giving up.
|
||||||
|
*
|
||||||
|
* This class is loosely based on the Symfony UniversalClassLoader.
|
||||||
|
*
|
||||||
|
* @author Fabien Potencier <fabien@symfony.com>
|
||||||
|
* @author Jordi Boggiano <j.boggiano@seld.be>
|
||||||
|
* @see https://www.php-fig.org/psr/psr-0/
|
||||||
|
* @see https://www.php-fig.org/psr/psr-4/
|
||||||
|
*/
|
||||||
|
class ClassLoader
|
||||||
|
{
|
||||||
|
/** @var \Closure(string):void */
|
||||||
|
private static $includeFile;
|
||||||
|
|
||||||
|
/** @var string|null */
|
||||||
|
private $vendorDir;
|
||||||
|
|
||||||
|
// PSR-4
|
||||||
|
/**
|
||||||
|
* @var array<string, array<string, int>>
|
||||||
|
*/
|
||||||
|
private $prefixLengthsPsr4 = array();
|
||||||
|
/**
|
||||||
|
* @var array<string, list<string>>
|
||||||
|
*/
|
||||||
|
private $prefixDirsPsr4 = array();
|
||||||
|
/**
|
||||||
|
* @var list<string>
|
||||||
|
*/
|
||||||
|
private $fallbackDirsPsr4 = array();
|
||||||
|
|
||||||
|
// PSR-0
|
||||||
|
/**
|
||||||
|
* List of PSR-0 prefixes
|
||||||
|
*
|
||||||
|
* Structured as array('F (first letter)' => array('Foo\Bar (full prefix)' => array('path', 'path2')))
|
||||||
|
*
|
||||||
|
* @var array<string, array<string, list<string>>>
|
||||||
|
*/
|
||||||
|
private $prefixesPsr0 = array();
|
||||||
|
/**
|
||||||
|
* @var list<string>
|
||||||
|
*/
|
||||||
|
private $fallbackDirsPsr0 = array();
|
||||||
|
|
||||||
|
/** @var bool */
|
||||||
|
private $useIncludePath = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array<string, string>
|
||||||
|
*/
|
||||||
|
private $classMap = array();
|
||||||
|
|
||||||
|
/** @var bool */
|
||||||
|
private $classMapAuthoritative = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array<string, bool>
|
||||||
|
*/
|
||||||
|
private $missingClasses = array();
|
||||||
|
|
||||||
|
/** @var string|null */
|
||||||
|
private $apcuPrefix;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array<string, self>
|
||||||
|
*/
|
||||||
|
private static $registeredLoaders = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string|null $vendorDir
|
||||||
|
*/
|
||||||
|
public function __construct($vendorDir = null)
|
||||||
|
{
|
||||||
|
$this->vendorDir = $vendorDir;
|
||||||
|
self::initializeIncludeClosure();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array<string, list<string>>
|
||||||
|
*/
|
||||||
|
public function getPrefixes()
|
||||||
|
{
|
||||||
|
if (!empty($this->prefixesPsr0)) {
|
||||||
|
return call_user_func_array('array_merge', array_values($this->prefixesPsr0));
|
||||||
|
}
|
||||||
|
|
||||||
|
return array();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array<string, list<string>>
|
||||||
|
*/
|
||||||
|
public function getPrefixesPsr4()
|
||||||
|
{
|
||||||
|
return $this->prefixDirsPsr4;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return list<string>
|
||||||
|
*/
|
||||||
|
public function getFallbackDirs()
|
||||||
|
{
|
||||||
|
return $this->fallbackDirsPsr0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return list<string>
|
||||||
|
*/
|
||||||
|
public function getFallbackDirsPsr4()
|
||||||
|
{
|
||||||
|
return $this->fallbackDirsPsr4;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array<string, string> Array of classname => path
|
||||||
|
*/
|
||||||
|
public function getClassMap()
|
||||||
|
{
|
||||||
|
return $this->classMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array<string, string> $classMap Class to filename map
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function addClassMap(array $classMap)
|
||||||
|
{
|
||||||
|
if ($this->classMap) {
|
||||||
|
$this->classMap = array_merge($this->classMap, $classMap);
|
||||||
|
} else {
|
||||||
|
$this->classMap = $classMap;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers a set of PSR-0 directories for a given prefix, either
|
||||||
|
* appending or prepending to the ones previously set for this prefix.
|
||||||
|
*
|
||||||
|
* @param string $prefix The prefix
|
||||||
|
* @param list<string>|string $paths The PSR-0 root directories
|
||||||
|
* @param bool $prepend Whether to prepend the directories
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function add($prefix, $paths, $prepend = false)
|
||||||
|
{
|
||||||
|
$paths = (array) $paths;
|
||||||
|
if (!$prefix) {
|
||||||
|
if ($prepend) {
|
||||||
|
$this->fallbackDirsPsr0 = array_merge(
|
||||||
|
$paths,
|
||||||
|
$this->fallbackDirsPsr0
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$this->fallbackDirsPsr0 = array_merge(
|
||||||
|
$this->fallbackDirsPsr0,
|
||||||
|
$paths
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$first = $prefix[0];
|
||||||
|
if (!isset($this->prefixesPsr0[$first][$prefix])) {
|
||||||
|
$this->prefixesPsr0[$first][$prefix] = $paths;
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ($prepend) {
|
||||||
|
$this->prefixesPsr0[$first][$prefix] = array_merge(
|
||||||
|
$paths,
|
||||||
|
$this->prefixesPsr0[$first][$prefix]
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$this->prefixesPsr0[$first][$prefix] = array_merge(
|
||||||
|
$this->prefixesPsr0[$first][$prefix],
|
||||||
|
$paths
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers a set of PSR-4 directories for a given namespace, either
|
||||||
|
* appending or prepending to the ones previously set for this namespace.
|
||||||
|
*
|
||||||
|
* @param string $prefix The prefix/namespace, with trailing '\\'
|
||||||
|
* @param list<string>|string $paths The PSR-4 base directories
|
||||||
|
* @param bool $prepend Whether to prepend the directories
|
||||||
|
*
|
||||||
|
* @throws \InvalidArgumentException
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function addPsr4($prefix, $paths, $prepend = false)
|
||||||
|
{
|
||||||
|
$paths = (array) $paths;
|
||||||
|
if (!$prefix) {
|
||||||
|
// Register directories for the root namespace.
|
||||||
|
if ($prepend) {
|
||||||
|
$this->fallbackDirsPsr4 = array_merge(
|
||||||
|
$paths,
|
||||||
|
$this->fallbackDirsPsr4
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$this->fallbackDirsPsr4 = array_merge(
|
||||||
|
$this->fallbackDirsPsr4,
|
||||||
|
$paths
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} elseif (!isset($this->prefixDirsPsr4[$prefix])) {
|
||||||
|
// Register directories for a new namespace.
|
||||||
|
$length = strlen($prefix);
|
||||||
|
if ('\\' !== $prefix[$length - 1]) {
|
||||||
|
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
|
||||||
|
}
|
||||||
|
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
|
||||||
|
$this->prefixDirsPsr4[$prefix] = $paths;
|
||||||
|
} elseif ($prepend) {
|
||||||
|
// Prepend directories for an already registered namespace.
|
||||||
|
$this->prefixDirsPsr4[$prefix] = array_merge(
|
||||||
|
$paths,
|
||||||
|
$this->prefixDirsPsr4[$prefix]
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
// Append directories for an already registered namespace.
|
||||||
|
$this->prefixDirsPsr4[$prefix] = array_merge(
|
||||||
|
$this->prefixDirsPsr4[$prefix],
|
||||||
|
$paths
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers a set of PSR-0 directories for a given prefix,
|
||||||
|
* replacing any others previously set for this prefix.
|
||||||
|
*
|
||||||
|
* @param string $prefix The prefix
|
||||||
|
* @param list<string>|string $paths The PSR-0 base directories
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function set($prefix, $paths)
|
||||||
|
{
|
||||||
|
if (!$prefix) {
|
||||||
|
$this->fallbackDirsPsr0 = (array) $paths;
|
||||||
|
} else {
|
||||||
|
$this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers a set of PSR-4 directories for a given namespace,
|
||||||
|
* replacing any others previously set for this namespace.
|
||||||
|
*
|
||||||
|
* @param string $prefix The prefix/namespace, with trailing '\\'
|
||||||
|
* @param list<string>|string $paths The PSR-4 base directories
|
||||||
|
*
|
||||||
|
* @throws \InvalidArgumentException
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function setPsr4($prefix, $paths)
|
||||||
|
{
|
||||||
|
if (!$prefix) {
|
||||||
|
$this->fallbackDirsPsr4 = (array) $paths;
|
||||||
|
} else {
|
||||||
|
$length = strlen($prefix);
|
||||||
|
if ('\\' !== $prefix[$length - 1]) {
|
||||||
|
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
|
||||||
|
}
|
||||||
|
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
|
||||||
|
$this->prefixDirsPsr4[$prefix] = (array) $paths;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Turns on searching the include path for class files.
|
||||||
|
*
|
||||||
|
* @param bool $useIncludePath
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function setUseIncludePath($useIncludePath)
|
||||||
|
{
|
||||||
|
$this->useIncludePath = $useIncludePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Can be used to check if the autoloader uses the include path to check
|
||||||
|
* for classes.
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function getUseIncludePath()
|
||||||
|
{
|
||||||
|
return $this->useIncludePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Turns off searching the prefix and fallback directories for classes
|
||||||
|
* that have not been registered with the class map.
|
||||||
|
*
|
||||||
|
* @param bool $classMapAuthoritative
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function setClassMapAuthoritative($classMapAuthoritative)
|
||||||
|
{
|
||||||
|
$this->classMapAuthoritative = $classMapAuthoritative;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Should class lookup fail if not found in the current class map?
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function isClassMapAuthoritative()
|
||||||
|
{
|
||||||
|
return $this->classMapAuthoritative;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* APCu prefix to use to cache found/not-found classes, if the extension is enabled.
|
||||||
|
*
|
||||||
|
* @param string|null $apcuPrefix
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function setApcuPrefix($apcuPrefix)
|
||||||
|
{
|
||||||
|
$this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The APCu prefix in use, or null if APCu caching is not enabled.
|
||||||
|
*
|
||||||
|
* @return string|null
|
||||||
|
*/
|
||||||
|
public function getApcuPrefix()
|
||||||
|
{
|
||||||
|
return $this->apcuPrefix;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers this instance as an autoloader.
|
||||||
|
*
|
||||||
|
* @param bool $prepend Whether to prepend the autoloader or not
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function register($prepend = false)
|
||||||
|
{
|
||||||
|
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
|
||||||
|
|
||||||
|
if (null === $this->vendorDir) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($prepend) {
|
||||||
|
self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders;
|
||||||
|
} else {
|
||||||
|
unset(self::$registeredLoaders[$this->vendorDir]);
|
||||||
|
self::$registeredLoaders[$this->vendorDir] = $this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unregisters this instance as an autoloader.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function unregister()
|
||||||
|
{
|
||||||
|
spl_autoload_unregister(array($this, 'loadClass'));
|
||||||
|
|
||||||
|
if (null !== $this->vendorDir) {
|
||||||
|
unset(self::$registeredLoaders[$this->vendorDir]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads the given class or interface.
|
||||||
|
*
|
||||||
|
* @param string $class The name of the class
|
||||||
|
* @return true|null True if loaded, null otherwise
|
||||||
|
*/
|
||||||
|
public function loadClass($class)
|
||||||
|
{
|
||||||
|
if ($file = $this->findFile($class)) {
|
||||||
|
$includeFile = self::$includeFile;
|
||||||
|
$includeFile($file);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finds the path to the file where the class is defined.
|
||||||
|
*
|
||||||
|
* @param string $class The name of the class
|
||||||
|
*
|
||||||
|
* @return string|false The path if found, false otherwise
|
||||||
|
*/
|
||||||
|
public function findFile($class)
|
||||||
|
{
|
||||||
|
// class map lookup
|
||||||
|
if (isset($this->classMap[$class])) {
|
||||||
|
return $this->classMap[$class];
|
||||||
|
}
|
||||||
|
if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (null !== $this->apcuPrefix) {
|
||||||
|
$file = apcu_fetch($this->apcuPrefix.$class, $hit);
|
||||||
|
if ($hit) {
|
||||||
|
return $file;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$file = $this->findFileWithExtension($class, '.php');
|
||||||
|
|
||||||
|
// Search for Hack files if we are running on HHVM
|
||||||
|
if (false === $file && defined('HHVM_VERSION')) {
|
||||||
|
$file = $this->findFileWithExtension($class, '.hh');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (null !== $this->apcuPrefix) {
|
||||||
|
apcu_add($this->apcuPrefix.$class, $file);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (false === $file) {
|
||||||
|
// Remember that this class does not exist.
|
||||||
|
$this->missingClasses[$class] = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $file;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the currently registered loaders keyed by their corresponding vendor directories.
|
||||||
|
*
|
||||||
|
* @return array<string, self>
|
||||||
|
*/
|
||||||
|
public static function getRegisteredLoaders()
|
||||||
|
{
|
||||||
|
return self::$registeredLoaders;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $class
|
||||||
|
* @param string $ext
|
||||||
|
* @return string|false
|
||||||
|
*/
|
||||||
|
private function findFileWithExtension($class, $ext)
|
||||||
|
{
|
||||||
|
// PSR-4 lookup
|
||||||
|
$logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
|
||||||
|
|
||||||
|
$first = $class[0];
|
||||||
|
if (isset($this->prefixLengthsPsr4[$first])) {
|
||||||
|
$subPath = $class;
|
||||||
|
while (false !== $lastPos = strrpos($subPath, '\\')) {
|
||||||
|
$subPath = substr($subPath, 0, $lastPos);
|
||||||
|
$search = $subPath . '\\';
|
||||||
|
if (isset($this->prefixDirsPsr4[$search])) {
|
||||||
|
$pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
|
||||||
|
foreach ($this->prefixDirsPsr4[$search] as $dir) {
|
||||||
|
if (file_exists($file = $dir . $pathEnd)) {
|
||||||
|
return $file;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// PSR-4 fallback dirs
|
||||||
|
foreach ($this->fallbackDirsPsr4 as $dir) {
|
||||||
|
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
|
||||||
|
return $file;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// PSR-0 lookup
|
||||||
|
if (false !== $pos = strrpos($class, '\\')) {
|
||||||
|
// namespaced class name
|
||||||
|
$logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
|
||||||
|
. strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
|
||||||
|
} else {
|
||||||
|
// PEAR-like class name
|
||||||
|
$logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($this->prefixesPsr0[$first])) {
|
||||||
|
foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
|
||||||
|
if (0 === strpos($class, $prefix)) {
|
||||||
|
foreach ($dirs as $dir) {
|
||||||
|
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
|
||||||
|
return $file;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// PSR-0 fallback dirs
|
||||||
|
foreach ($this->fallbackDirsPsr0 as $dir) {
|
||||||
|
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
|
||||||
|
return $file;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// PSR-0 include paths.
|
||||||
|
if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
|
||||||
|
return $file;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
private static function initializeIncludeClosure()
|
||||||
|
{
|
||||||
|
if (self::$includeFile !== null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Scope isolated include.
|
||||||
|
*
|
||||||
|
* Prevents access to $this/self from included files.
|
||||||
|
*
|
||||||
|
* @param string $file
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
self::$includeFile = \Closure::bind(static function($file) {
|
||||||
|
include $file;
|
||||||
|
}, null, null);
|
||||||
|
}
|
||||||
|
}
|
359
vendor/composer/InstalledVersions.php
vendored
Normal file
@ -0,0 +1,359 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of Composer.
|
||||||
|
*
|
||||||
|
* (c) Nils Adermann <naderman@naderman.de>
|
||||||
|
* Jordi Boggiano <j.boggiano@seld.be>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Composer;
|
||||||
|
|
||||||
|
use Composer\Autoload\ClassLoader;
|
||||||
|
use Composer\Semver\VersionParser;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class is copied in every Composer installed project and available to all
|
||||||
|
*
|
||||||
|
* See also https://getcomposer.org/doc/07-runtime.md#installed-versions
|
||||||
|
*
|
||||||
|
* To require its presence, you can require `composer-runtime-api ^2.0`
|
||||||
|
*
|
||||||
|
* @final
|
||||||
|
*/
|
||||||
|
class InstalledVersions
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var mixed[]|null
|
||||||
|
* @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}|array{}|null
|
||||||
|
*/
|
||||||
|
private static $installed;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var bool|null
|
||||||
|
*/
|
||||||
|
private static $canGetVendors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array[]
|
||||||
|
* @psalm-var array<string, array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
|
||||||
|
*/
|
||||||
|
private static $installedByVendor = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a list of all package names which are present, either by being installed, replaced or provided
|
||||||
|
*
|
||||||
|
* @return string[]
|
||||||
|
* @psalm-return list<string>
|
||||||
|
*/
|
||||||
|
public static function getInstalledPackages()
|
||||||
|
{
|
||||||
|
$packages = array();
|
||||||
|
foreach (self::getInstalled() as $installed) {
|
||||||
|
$packages[] = array_keys($installed['versions']);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (1 === \count($packages)) {
|
||||||
|
return $packages[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
return array_keys(array_flip(\call_user_func_array('array_merge', $packages)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a list of all package names with a specific type e.g. 'library'
|
||||||
|
*
|
||||||
|
* @param string $type
|
||||||
|
* @return string[]
|
||||||
|
* @psalm-return list<string>
|
||||||
|
*/
|
||||||
|
public static function getInstalledPackagesByType($type)
|
||||||
|
{
|
||||||
|
$packagesByType = array();
|
||||||
|
|
||||||
|
foreach (self::getInstalled() as $installed) {
|
||||||
|
foreach ($installed['versions'] as $name => $package) {
|
||||||
|
if (isset($package['type']) && $package['type'] === $type) {
|
||||||
|
$packagesByType[] = $name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $packagesByType;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks whether the given package is installed
|
||||||
|
*
|
||||||
|
* This also returns true if the package name is provided or replaced by another package
|
||||||
|
*
|
||||||
|
* @param string $packageName
|
||||||
|
* @param bool $includeDevRequirements
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public static function isInstalled($packageName, $includeDevRequirements = true)
|
||||||
|
{
|
||||||
|
foreach (self::getInstalled() as $installed) {
|
||||||
|
if (isset($installed['versions'][$packageName])) {
|
||||||
|
return $includeDevRequirements || !isset($installed['versions'][$packageName]['dev_requirement']) || $installed['versions'][$packageName]['dev_requirement'] === false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks whether the given package satisfies a version constraint
|
||||||
|
*
|
||||||
|
* e.g. If you want to know whether version 2.3+ of package foo/bar is installed, you would call:
|
||||||
|
*
|
||||||
|
* Composer\InstalledVersions::satisfies(new VersionParser, 'foo/bar', '^2.3')
|
||||||
|
*
|
||||||
|
* @param VersionParser $parser Install composer/semver to have access to this class and functionality
|
||||||
|
* @param string $packageName
|
||||||
|
* @param string|null $constraint A version constraint to check for, if you pass one you have to make sure composer/semver is required by your package
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public static function satisfies(VersionParser $parser, $packageName, $constraint)
|
||||||
|
{
|
||||||
|
$constraint = $parser->parseConstraints((string) $constraint);
|
||||||
|
$provided = $parser->parseConstraints(self::getVersionRanges($packageName));
|
||||||
|
|
||||||
|
return $provided->matches($constraint);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a version constraint representing all the range(s) which are installed for a given package
|
||||||
|
*
|
||||||
|
* It is easier to use this via isInstalled() with the $constraint argument if you need to check
|
||||||
|
* whether a given version of a package is installed, and not just whether it exists
|
||||||
|
*
|
||||||
|
* @param string $packageName
|
||||||
|
* @return string Version constraint usable with composer/semver
|
||||||
|
*/
|
||||||
|
public static function getVersionRanges($packageName)
|
||||||
|
{
|
||||||
|
foreach (self::getInstalled() as $installed) {
|
||||||
|
if (!isset($installed['versions'][$packageName])) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$ranges = array();
|
||||||
|
if (isset($installed['versions'][$packageName]['pretty_version'])) {
|
||||||
|
$ranges[] = $installed['versions'][$packageName]['pretty_version'];
|
||||||
|
}
|
||||||
|
if (array_key_exists('aliases', $installed['versions'][$packageName])) {
|
||||||
|
$ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']);
|
||||||
|
}
|
||||||
|
if (array_key_exists('replaced', $installed['versions'][$packageName])) {
|
||||||
|
$ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']);
|
||||||
|
}
|
||||||
|
if (array_key_exists('provided', $installed['versions'][$packageName])) {
|
||||||
|
$ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return implode(' || ', $ranges);
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $packageName
|
||||||
|
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present
|
||||||
|
*/
|
||||||
|
public static function getVersion($packageName)
|
||||||
|
{
|
||||||
|
foreach (self::getInstalled() as $installed) {
|
||||||
|
if (!isset($installed['versions'][$packageName])) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isset($installed['versions'][$packageName]['version'])) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $installed['versions'][$packageName]['version'];
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $packageName
|
||||||
|
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present
|
||||||
|
*/
|
||||||
|
public static function getPrettyVersion($packageName)
|
||||||
|
{
|
||||||
|
foreach (self::getInstalled() as $installed) {
|
||||||
|
if (!isset($installed['versions'][$packageName])) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isset($installed['versions'][$packageName]['pretty_version'])) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $installed['versions'][$packageName]['pretty_version'];
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $packageName
|
||||||
|
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as reference
|
||||||
|
*/
|
||||||
|
public static function getReference($packageName)
|
||||||
|
{
|
||||||
|
foreach (self::getInstalled() as $installed) {
|
||||||
|
if (!isset($installed['versions'][$packageName])) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isset($installed['versions'][$packageName]['reference'])) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $installed['versions'][$packageName]['reference'];
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $packageName
|
||||||
|
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as install path. Packages of type metapackages also have a null install path.
|
||||||
|
*/
|
||||||
|
public static function getInstallPath($packageName)
|
||||||
|
{
|
||||||
|
foreach (self::getInstalled() as $installed) {
|
||||||
|
if (!isset($installed['versions'][$packageName])) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
return isset($installed['versions'][$packageName]['install_path']) ? $installed['versions'][$packageName]['install_path'] : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
* @psalm-return array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}
|
||||||
|
*/
|
||||||
|
public static function getRootPackage()
|
||||||
|
{
|
||||||
|
$installed = self::getInstalled();
|
||||||
|
|
||||||
|
return $installed[0]['root'];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the raw installed.php data for custom implementations
|
||||||
|
*
|
||||||
|
* @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect.
|
||||||
|
* @return array[]
|
||||||
|
* @psalm-return array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}
|
||||||
|
*/
|
||||||
|
public static function getRawData()
|
||||||
|
{
|
||||||
|
@trigger_error('getRawData only returns the first dataset loaded, which may not be what you expect. Use getAllRawData() instead which returns all datasets for all autoloaders present in the process.', E_USER_DEPRECATED);
|
||||||
|
|
||||||
|
if (null === self::$installed) {
|
||||||
|
// only require the installed.php file if this file is loaded from its dumped location,
|
||||||
|
// and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
|
||||||
|
if (substr(__DIR__, -8, 1) !== 'C') {
|
||||||
|
self::$installed = include __DIR__ . '/installed.php';
|
||||||
|
} else {
|
||||||
|
self::$installed = array();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return self::$installed;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the raw data of all installed.php which are currently loaded for custom implementations
|
||||||
|
*
|
||||||
|
* @return array[]
|
||||||
|
* @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
|
||||||
|
*/
|
||||||
|
public static function getAllRawData()
|
||||||
|
{
|
||||||
|
return self::getInstalled();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lets you reload the static array from another file
|
||||||
|
*
|
||||||
|
* This is only useful for complex integrations in which a project needs to use
|
||||||
|
* this class but then also needs to execute another project's autoloader in process,
|
||||||
|
* and wants to ensure both projects have access to their version of installed.php.
|
||||||
|
*
|
||||||
|
* A typical case would be PHPUnit, where it would need to make sure it reads all
|
||||||
|
* the data it needs from this class, then call reload() with
|
||||||
|
* `require $CWD/vendor/composer/installed.php` (or similar) as input to make sure
|
||||||
|
* the project in which it runs can then also use this class safely, without
|
||||||
|
* interference between PHPUnit's dependencies and the project's dependencies.
|
||||||
|
*
|
||||||
|
* @param array[] $data A vendor/composer/installed.php data set
|
||||||
|
* @return void
|
||||||
|
*
|
||||||
|
* @psalm-param array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $data
|
||||||
|
*/
|
||||||
|
public static function reload($data)
|
||||||
|
{
|
||||||
|
self::$installed = $data;
|
||||||
|
self::$installedByVendor = array();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array[]
|
||||||
|
* @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
|
||||||
|
*/
|
||||||
|
private static function getInstalled()
|
||||||
|
{
|
||||||
|
if (null === self::$canGetVendors) {
|
||||||
|
self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders');
|
||||||
|
}
|
||||||
|
|
||||||
|
$installed = array();
|
||||||
|
|
||||||
|
if (self::$canGetVendors) {
|
||||||
|
foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
|
||||||
|
if (isset(self::$installedByVendor[$vendorDir])) {
|
||||||
|
$installed[] = self::$installedByVendor[$vendorDir];
|
||||||
|
} elseif (is_file($vendorDir.'/composer/installed.php')) {
|
||||||
|
/** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
|
||||||
|
$required = require $vendorDir.'/composer/installed.php';
|
||||||
|
$installed[] = self::$installedByVendor[$vendorDir] = $required;
|
||||||
|
if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
|
||||||
|
self::$installed = $installed[count($installed) - 1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (null === self::$installed) {
|
||||||
|
// only require the installed.php file if this file is loaded from its dumped location,
|
||||||
|
// and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
|
||||||
|
if (substr(__DIR__, -8, 1) !== 'C') {
|
||||||
|
/** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
|
||||||
|
$required = require __DIR__ . '/installed.php';
|
||||||
|
self::$installed = $required;
|
||||||
|
} else {
|
||||||
|
self::$installed = array();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (self::$installed !== array()) {
|
||||||
|
$installed[] = self::$installed;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $installed;
|
||||||
|
}
|
||||||
|
}
|
21
vendor/composer/LICENSE
vendored
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
|
||||||
|
Copyright (c) Nils Adermann, Jordi Boggiano
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is furnished
|
||||||
|
to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
||||||
|
|
21
vendor/composer/autoload_classmap.php
vendored
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
// autoload_classmap.php @generated by Composer
|
||||||
|
|
||||||
|
$vendorDir = dirname(__DIR__);
|
||||||
|
$baseDir = dirname($vendorDir);
|
||||||
|
|
||||||
|
return array(
|
||||||
|
'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php',
|
||||||
|
'DateError' => $vendorDir . '/symfony/polyfill-php83/Resources/stubs/DateError.php',
|
||||||
|
'DateException' => $vendorDir . '/symfony/polyfill-php83/Resources/stubs/DateException.php',
|
||||||
|
'DateInvalidOperationException' => $vendorDir . '/symfony/polyfill-php83/Resources/stubs/DateInvalidOperationException.php',
|
||||||
|
'DateInvalidTimeZoneException' => $vendorDir . '/symfony/polyfill-php83/Resources/stubs/DateInvalidTimeZoneException.php',
|
||||||
|
'DateMalformedIntervalStringException' => $vendorDir . '/symfony/polyfill-php83/Resources/stubs/DateMalformedIntervalStringException.php',
|
||||||
|
'DateMalformedPeriodStringException' => $vendorDir . '/symfony/polyfill-php83/Resources/stubs/DateMalformedPeriodStringException.php',
|
||||||
|
'DateMalformedStringException' => $vendorDir . '/symfony/polyfill-php83/Resources/stubs/DateMalformedStringException.php',
|
||||||
|
'DateObjectError' => $vendorDir . '/symfony/polyfill-php83/Resources/stubs/DateObjectError.php',
|
||||||
|
'DateRangeError' => $vendorDir . '/symfony/polyfill-php83/Resources/stubs/DateRangeError.php',
|
||||||
|
'Override' => $vendorDir . '/symfony/polyfill-php83/Resources/stubs/Override.php',
|
||||||
|
'SQLite3Exception' => $vendorDir . '/symfony/polyfill-php83/Resources/stubs/SQLite3Exception.php',
|
||||||
|
);
|
20
vendor/composer/autoload_files.php
vendored
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
// autoload_files.php @generated by Composer
|
||||||
|
|
||||||
|
$vendorDir = dirname(__DIR__);
|
||||||
|
$baseDir = dirname($vendorDir);
|
||||||
|
|
||||||
|
return array(
|
||||||
|
'ad155f8f1cf0d418fe49e248db8c661b' => $vendorDir . '/react/promise/src/functions_include.php',
|
||||||
|
'7b11c4dc42b3b3023073cb14e519683c' => $vendorDir . '/ralouphie/getallheaders/src/getallheaders.php',
|
||||||
|
'6e3fae29631ef280660b3cdad06f25a8' => $vendorDir . '/symfony/deprecation-contracts/function.php',
|
||||||
|
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php',
|
||||||
|
'662a729f963d39afe703c9d9b7ab4a8c' => $vendorDir . '/symfony/polyfill-php83/bootstrap.php',
|
||||||
|
'2203a247e6fda86070a5e4e07aed533a' => $vendorDir . '/symfony/clock/Resources/now.php',
|
||||||
|
'a1105708a18b76903365ca1c4aa61b02' => $vendorDir . '/symfony/translation/Resources/functions.php',
|
||||||
|
'3be16222a6efa6dd226a219eaaff823b' => $vendorDir . '/ratchet/pawl/src/functions_include.php',
|
||||||
|
'c4e03ecd470d2a87804979c0a8152284' => $vendorDir . '/react/async/src/functions_include.php',
|
||||||
|
'37a3dc5111fe8f707ab4c132ef1dbc62' => $vendorDir . '/guzzlehttp/guzzle/src/functions_include.php',
|
||||||
|
'864b292aadc96fda0e2642b894a38d16' => $vendorDir . '/team-reflex/discord-php/src/Discord/functions.php',
|
||||||
|
);
|
10
vendor/composer/autoload_namespaces.php
vendored
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
// autoload_namespaces.php @generated by Composer
|
||||||
|
|
||||||
|
$vendorDir = dirname(__DIR__);
|
||||||
|
$baseDir = dirname($vendorDir);
|
||||||
|
|
||||||
|
return array(
|
||||||
|
'TrafficCophp' => array($vendorDir . '/trafficcophp/bytebuffer/src'),
|
||||||
|
);
|
45
vendor/composer/autoload_psr4.php
vendored
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
// autoload_psr4.php @generated by Composer
|
||||||
|
|
||||||
|
$vendorDir = dirname(__DIR__);
|
||||||
|
$baseDir = dirname($vendorDir);
|
||||||
|
|
||||||
|
return array(
|
||||||
|
'Tests\\Discord\\Http\\' => array($vendorDir . '/discord-php/http/tests/Discord'),
|
||||||
|
'Symfony\\Polyfill\\Php83\\' => array($vendorDir . '/symfony/polyfill-php83'),
|
||||||
|
'Symfony\\Polyfill\\Mbstring\\' => array($vendorDir . '/symfony/polyfill-mbstring'),
|
||||||
|
'Symfony\\Contracts\\Translation\\' => array($vendorDir . '/symfony/translation-contracts'),
|
||||||
|
'Symfony\\Component\\Translation\\' => array($vendorDir . '/symfony/translation'),
|
||||||
|
'Symfony\\Component\\OptionsResolver\\' => array($vendorDir . '/symfony/options-resolver'),
|
||||||
|
'Symfony\\Component\\Clock\\' => array($vendorDir . '/symfony/clock'),
|
||||||
|
'React\\Stream\\' => array($vendorDir . '/react/stream/src'),
|
||||||
|
'React\\Socket\\' => array($vendorDir . '/react/socket/src'),
|
||||||
|
'React\\Promise\\' => array($vendorDir . '/react/promise/src'),
|
||||||
|
'React\\Http\\' => array($vendorDir . '/react/http/src'),
|
||||||
|
'React\\EventLoop\\' => array($vendorDir . '/react/event-loop/src'),
|
||||||
|
'React\\Dns\\' => array($vendorDir . '/react/dns/src'),
|
||||||
|
'React\\Datagram\\' => array($vendorDir . '/react/datagram/src'),
|
||||||
|
'React\\ChildProcess\\' => array($vendorDir . '/react/child-process/src'),
|
||||||
|
'React\\Cache\\' => array($vendorDir . '/react/cache/src'),
|
||||||
|
'React\\Async\\' => array($vendorDir . '/react/async/src'),
|
||||||
|
'Ratchet\\RFC6455\\' => array($vendorDir . '/ratchet/rfc6455/src'),
|
||||||
|
'Ratchet\\Client\\' => array($vendorDir . '/ratchet/pawl/src'),
|
||||||
|
'Psr\\SimpleCache\\' => array($vendorDir . '/psr/simple-cache/src'),
|
||||||
|
'Psr\\Log\\' => array($vendorDir . '/psr/log/src'),
|
||||||
|
'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-message/src', $vendorDir . '/psr/http-factory/src'),
|
||||||
|
'Psr\\Http\\Client\\' => array($vendorDir . '/psr/http-client/src'),
|
||||||
|
'Psr\\Clock\\' => array($vendorDir . '/psr/clock/src'),
|
||||||
|
'Monolog\\' => array($vendorDir . '/monolog/monolog/src/Monolog'),
|
||||||
|
'GuzzleHttp\\Psr7\\' => array($vendorDir . '/guzzlehttp/psr7/src'),
|
||||||
|
'GuzzleHttp\\Promise\\' => array($vendorDir . '/guzzlehttp/promises/src'),
|
||||||
|
'GuzzleHttp\\' => array($vendorDir . '/guzzlehttp/guzzle/src'),
|
||||||
|
'Fig\\Http\\Message\\' => array($vendorDir . '/fig/http-message-util/src'),
|
||||||
|
'Evenement\\' => array($vendorDir . '/evenement/evenement/src'),
|
||||||
|
'Discord\\Http\\' => array($vendorDir . '/discord-php/http/src/Discord'),
|
||||||
|
'Discord\\' => array($vendorDir . '/discord/interactions/discord', $vendorDir . '/team-reflex/discord-php/src/Discord'),
|
||||||
|
'DantSu\\PHPImageEditor\\' => array($vendorDir . '/dantsu/php-image-editor/src'),
|
||||||
|
'DantSu\\OpenStreetMapStaticAPI\\' => array($vendorDir . '/dantsu/php-osm-static-api/src'),
|
||||||
|
'Carbon\\Doctrine\\' => array($vendorDir . '/carbonphp/carbon-doctrine-types/src/Carbon/Doctrine'),
|
||||||
|
'Carbon\\' => array($vendorDir . '/nesbot/carbon/src/Carbon'),
|
||||||
|
);
|
50
vendor/composer/autoload_real.php
vendored
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
// autoload_real.php @generated by Composer
|
||||||
|
|
||||||
|
class ComposerAutoloaderInit39e76b5f4d8c6722589be79886dc5716
|
||||||
|
{
|
||||||
|
private static $loader;
|
||||||
|
|
||||||
|
public static function loadClassLoader($class)
|
||||||
|
{
|
||||||
|
if ('Composer\Autoload\ClassLoader' === $class) {
|
||||||
|
require __DIR__ . '/ClassLoader.php';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return \Composer\Autoload\ClassLoader
|
||||||
|
*/
|
||||||
|
public static function getLoader()
|
||||||
|
{
|
||||||
|
if (null !== self::$loader) {
|
||||||
|
return self::$loader;
|
||||||
|
}
|
||||||
|
|
||||||
|
require __DIR__ . '/platform_check.php';
|
||||||
|
|
||||||
|
spl_autoload_register(array('ComposerAutoloaderInit39e76b5f4d8c6722589be79886dc5716', 'loadClassLoader'), true, true);
|
||||||
|
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
||||||
|
spl_autoload_unregister(array('ComposerAutoloaderInit39e76b5f4d8c6722589be79886dc5716', 'loadClassLoader'));
|
||||||
|
|
||||||
|
require __DIR__ . '/autoload_static.php';
|
||||||
|
call_user_func(\Composer\Autoload\ComposerStaticInit39e76b5f4d8c6722589be79886dc5716::getInitializer($loader));
|
||||||
|
|
||||||
|
$loader->register(true);
|
||||||
|
|
||||||
|
$filesToLoad = \Composer\Autoload\ComposerStaticInit39e76b5f4d8c6722589be79886dc5716::$files;
|
||||||
|
$requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
|
||||||
|
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
||||||
|
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
|
||||||
|
|
||||||
|
require $file;
|
||||||
|
}
|
||||||
|
}, null, null);
|
||||||
|
foreach ($filesToLoad as $fileIdentifier => $file) {
|
||||||
|
$requireFile($fileIdentifier, $file);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $loader;
|
||||||
|
}
|
||||||
|
}
|
276
vendor/composer/autoload_static.php
vendored
Normal file
@ -0,0 +1,276 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
// autoload_static.php @generated by Composer
|
||||||
|
|
||||||
|
namespace Composer\Autoload;
|
||||||
|
|
||||||
|
class ComposerStaticInit39e76b5f4d8c6722589be79886dc5716
|
||||||
|
{
|
||||||
|
public static $files = array (
|
||||||
|
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
|
||||||
|
'7b11c4dc42b3b3023073cb14e519683c' => __DIR__ . '/..' . '/ralouphie/getallheaders/src/getallheaders.php',
|
||||||
|
'6e3fae29631ef280660b3cdad06f25a8' => __DIR__ . '/..' . '/symfony/deprecation-contracts/function.php',
|
||||||
|
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
|
||||||
|
'662a729f963d39afe703c9d9b7ab4a8c' => __DIR__ . '/..' . '/symfony/polyfill-php83/bootstrap.php',
|
||||||
|
'2203a247e6fda86070a5e4e07aed533a' => __DIR__ . '/..' . '/symfony/clock/Resources/now.php',
|
||||||
|
'a1105708a18b76903365ca1c4aa61b02' => __DIR__ . '/..' . '/symfony/translation/Resources/functions.php',
|
||||||
|
'3be16222a6efa6dd226a219eaaff823b' => __DIR__ . '/..' . '/ratchet/pawl/src/functions_include.php',
|
||||||
|
'c4e03ecd470d2a87804979c0a8152284' => __DIR__ . '/..' . '/react/async/src/functions_include.php',
|
||||||
|
'37a3dc5111fe8f707ab4c132ef1dbc62' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/functions_include.php',
|
||||||
|
'864b292aadc96fda0e2642b894a38d16' => __DIR__ . '/..' . '/team-reflex/discord-php/src/Discord/functions.php',
|
||||||
|
);
|
||||||
|
|
||||||
|
public static $prefixLengthsPsr4 = array (
|
||||||
|
'T' =>
|
||||||
|
array (
|
||||||
|
'Tests\\Discord\\Http\\' => 19,
|
||||||
|
),
|
||||||
|
'S' =>
|
||||||
|
array (
|
||||||
|
'Symfony\\Polyfill\\Php83\\' => 23,
|
||||||
|
'Symfony\\Polyfill\\Mbstring\\' => 26,
|
||||||
|
'Symfony\\Contracts\\Translation\\' => 30,
|
||||||
|
'Symfony\\Component\\Translation\\' => 30,
|
||||||
|
'Symfony\\Component\\OptionsResolver\\' => 34,
|
||||||
|
'Symfony\\Component\\Clock\\' => 24,
|
||||||
|
),
|
||||||
|
'R' =>
|
||||||
|
array (
|
||||||
|
'React\\Stream\\' => 13,
|
||||||
|
'React\\Socket\\' => 13,
|
||||||
|
'React\\Promise\\' => 14,
|
||||||
|
'React\\Http\\' => 11,
|
||||||
|
'React\\EventLoop\\' => 16,
|
||||||
|
'React\\Dns\\' => 10,
|
||||||
|
'React\\Datagram\\' => 15,
|
||||||
|
'React\\ChildProcess\\' => 19,
|
||||||
|
'React\\Cache\\' => 12,
|
||||||
|
'React\\Async\\' => 12,
|
||||||
|
'Ratchet\\RFC6455\\' => 16,
|
||||||
|
'Ratchet\\Client\\' => 15,
|
||||||
|
),
|
||||||
|
'P' =>
|
||||||
|
array (
|
||||||
|
'Psr\\SimpleCache\\' => 16,
|
||||||
|
'Psr\\Log\\' => 8,
|
||||||
|
'Psr\\Http\\Message\\' => 17,
|
||||||
|
'Psr\\Http\\Client\\' => 16,
|
||||||
|
'Psr\\Clock\\' => 10,
|
||||||
|
),
|
||||||
|
'M' =>
|
||||||
|
array (
|
||||||
|
'Monolog\\' => 8,
|
||||||
|
),
|
||||||
|
'G' =>
|
||||||
|
array (
|
||||||
|
'GuzzleHttp\\Psr7\\' => 16,
|
||||||
|
'GuzzleHttp\\Promise\\' => 19,
|
||||||
|
'GuzzleHttp\\' => 11,
|
||||||
|
),
|
||||||
|
'F' =>
|
||||||
|
array (
|
||||||
|
'Fig\\Http\\Message\\' => 17,
|
||||||
|
),
|
||||||
|
'E' =>
|
||||||
|
array (
|
||||||
|
'Evenement\\' => 10,
|
||||||
|
),
|
||||||
|
'D' =>
|
||||||
|
array (
|
||||||
|
'Discord\\Http\\' => 13,
|
||||||
|
'Discord\\' => 8,
|
||||||
|
'DantSu\\PHPImageEditor\\' => 22,
|
||||||
|
'DantSu\\OpenStreetMapStaticAPI\\' => 30,
|
||||||
|
),
|
||||||
|
'C' =>
|
||||||
|
array (
|
||||||
|
'Carbon\\Doctrine\\' => 16,
|
||||||
|
'Carbon\\' => 7,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
public static $prefixDirsPsr4 = array (
|
||||||
|
'Tests\\Discord\\Http\\' =>
|
||||||
|
array (
|
||||||
|
0 => __DIR__ . '/..' . '/discord-php/http/tests/Discord',
|
||||||
|
),
|
||||||
|
'Symfony\\Polyfill\\Php83\\' =>
|
||||||
|
array (
|
||||||
|
0 => __DIR__ . '/..' . '/symfony/polyfill-php83',
|
||||||
|
),
|
||||||
|
'Symfony\\Polyfill\\Mbstring\\' =>
|
||||||
|
array (
|
||||||
|
0 => __DIR__ . '/..' . '/symfony/polyfill-mbstring',
|
||||||
|
),
|
||||||
|
'Symfony\\Contracts\\Translation\\' =>
|
||||||
|
array (
|
||||||
|
0 => __DIR__ . '/..' . '/symfony/translation-contracts',
|
||||||
|
),
|
||||||
|
'Symfony\\Component\\Translation\\' =>
|
||||||
|
array (
|
||||||
|
0 => __DIR__ . '/..' . '/symfony/translation',
|
||||||
|
),
|
||||||
|
'Symfony\\Component\\OptionsResolver\\' =>
|
||||||
|
array (
|
||||||
|
0 => __DIR__ . '/..' . '/symfony/options-resolver',
|
||||||
|
),
|
||||||
|
'Symfony\\Component\\Clock\\' =>
|
||||||
|
array (
|
||||||
|
0 => __DIR__ . '/..' . '/symfony/clock',
|
||||||
|
),
|
||||||
|
'React\\Stream\\' =>
|
||||||
|
array (
|
||||||
|
0 => __DIR__ . '/..' . '/react/stream/src',
|
||||||
|
),
|
||||||
|
'React\\Socket\\' =>
|
||||||
|
array (
|
||||||
|
0 => __DIR__ . '/..' . '/react/socket/src',
|
||||||
|
),
|
||||||
|
'React\\Promise\\' =>
|
||||||
|
array (
|
||||||
|
0 => __DIR__ . '/..' . '/react/promise/src',
|
||||||
|
),
|
||||||
|
'React\\Http\\' =>
|
||||||
|
array (
|
||||||
|
0 => __DIR__ . '/..' . '/react/http/src',
|
||||||
|
),
|
||||||
|
'React\\EventLoop\\' =>
|
||||||
|
array (
|
||||||
|
0 => __DIR__ . '/..' . '/react/event-loop/src',
|
||||||
|
),
|
||||||
|
'React\\Dns\\' =>
|
||||||
|
array (
|
||||||
|
0 => __DIR__ . '/..' . '/react/dns/src',
|
||||||
|
),
|
||||||
|
'React\\Datagram\\' =>
|
||||||
|
array (
|
||||||
|
0 => __DIR__ . '/..' . '/react/datagram/src',
|
||||||
|
),
|
||||||
|
'React\\ChildProcess\\' =>
|
||||||
|
array (
|
||||||
|
0 => __DIR__ . '/..' . '/react/child-process/src',
|
||||||
|
),
|
||||||
|
'React\\Cache\\' =>
|
||||||
|
array (
|
||||||
|
0 => __DIR__ . '/..' . '/react/cache/src',
|
||||||
|
),
|
||||||
|
'React\\Async\\' =>
|
||||||
|
array (
|
||||||
|
0 => __DIR__ . '/..' . '/react/async/src',
|
||||||
|
),
|
||||||
|
'Ratchet\\RFC6455\\' =>
|
||||||
|
array (
|
||||||
|
0 => __DIR__ . '/..' . '/ratchet/rfc6455/src',
|
||||||
|
),
|
||||||
|
'Ratchet\\Client\\' =>
|
||||||
|
array (
|
||||||
|
0 => __DIR__ . '/..' . '/ratchet/pawl/src',
|
||||||
|
),
|
||||||
|
'Psr\\SimpleCache\\' =>
|
||||||
|
array (
|
||||||
|
0 => __DIR__ . '/..' . '/psr/simple-cache/src',
|
||||||
|
),
|
||||||
|
'Psr\\Log\\' =>
|
||||||
|
array (
|
||||||
|
0 => __DIR__ . '/..' . '/psr/log/src',
|
||||||
|
),
|
||||||
|
'Psr\\Http\\Message\\' =>
|
||||||
|
array (
|
||||||
|
0 => __DIR__ . '/..' . '/psr/http-message/src',
|
||||||
|
1 => __DIR__ . '/..' . '/psr/http-factory/src',
|
||||||
|
),
|
||||||
|
'Psr\\Http\\Client\\' =>
|
||||||
|
array (
|
||||||
|
0 => __DIR__ . '/..' . '/psr/http-client/src',
|
||||||
|
),
|
||||||
|
'Psr\\Clock\\' =>
|
||||||
|
array (
|
||||||
|
0 => __DIR__ . '/..' . '/psr/clock/src',
|
||||||
|
),
|
||||||
|
'Monolog\\' =>
|
||||||
|
array (
|
||||||
|
0 => __DIR__ . '/..' . '/monolog/monolog/src/Monolog',
|
||||||
|
),
|
||||||
|
'GuzzleHttp\\Psr7\\' =>
|
||||||
|
array (
|
||||||
|
0 => __DIR__ . '/..' . '/guzzlehttp/psr7/src',
|
||||||
|
),
|
||||||
|
'GuzzleHttp\\Promise\\' =>
|
||||||
|
array (
|
||||||
|
0 => __DIR__ . '/..' . '/guzzlehttp/promises/src',
|
||||||
|
),
|
||||||
|
'GuzzleHttp\\' =>
|
||||||
|
array (
|
||||||
|
0 => __DIR__ . '/..' . '/guzzlehttp/guzzle/src',
|
||||||
|
),
|
||||||
|
'Fig\\Http\\Message\\' =>
|
||||||
|
array (
|
||||||
|
0 => __DIR__ . '/..' . '/fig/http-message-util/src',
|
||||||
|
),
|
||||||
|
'Evenement\\' =>
|
||||||
|
array (
|
||||||
|
0 => __DIR__ . '/..' . '/evenement/evenement/src',
|
||||||
|
),
|
||||||
|
'Discord\\Http\\' =>
|
||||||
|
array (
|
||||||
|
0 => __DIR__ . '/..' . '/discord-php/http/src/Discord',
|
||||||
|
),
|
||||||
|
'Discord\\' =>
|
||||||
|
array (
|
||||||
|
0 => __DIR__ . '/..' . '/discord/interactions/discord',
|
||||||
|
1 => __DIR__ . '/..' . '/team-reflex/discord-php/src/Discord',
|
||||||
|
),
|
||||||
|
'DantSu\\PHPImageEditor\\' =>
|
||||||
|
array (
|
||||||
|
0 => __DIR__ . '/..' . '/dantsu/php-image-editor/src',
|
||||||
|
),
|
||||||
|
'DantSu\\OpenStreetMapStaticAPI\\' =>
|
||||||
|
array (
|
||||||
|
0 => __DIR__ . '/..' . '/dantsu/php-osm-static-api/src',
|
||||||
|
),
|
||||||
|
'Carbon\\Doctrine\\' =>
|
||||||
|
array (
|
||||||
|
0 => __DIR__ . '/..' . '/carbonphp/carbon-doctrine-types/src/Carbon/Doctrine',
|
||||||
|
),
|
||||||
|
'Carbon\\' =>
|
||||||
|
array (
|
||||||
|
0 => __DIR__ . '/..' . '/nesbot/carbon/src/Carbon',
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
public static $prefixesPsr0 = array (
|
||||||
|
'T' =>
|
||||||
|
array (
|
||||||
|
'TrafficCophp' =>
|
||||||
|
array (
|
||||||
|
0 => __DIR__ . '/..' . '/trafficcophp/bytebuffer/src',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
public static $classMap = array (
|
||||||
|
'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
|
||||||
|
'DateError' => __DIR__ . '/..' . '/symfony/polyfill-php83/Resources/stubs/DateError.php',
|
||||||
|
'DateException' => __DIR__ . '/..' . '/symfony/polyfill-php83/Resources/stubs/DateException.php',
|
||||||
|
'DateInvalidOperationException' => __DIR__ . '/..' . '/symfony/polyfill-php83/Resources/stubs/DateInvalidOperationException.php',
|
||||||
|
'DateInvalidTimeZoneException' => __DIR__ . '/..' . '/symfony/polyfill-php83/Resources/stubs/DateInvalidTimeZoneException.php',
|
||||||
|
'DateMalformedIntervalStringException' => __DIR__ . '/..' . '/symfony/polyfill-php83/Resources/stubs/DateMalformedIntervalStringException.php',
|
||||||
|
'DateMalformedPeriodStringException' => __DIR__ . '/..' . '/symfony/polyfill-php83/Resources/stubs/DateMalformedPeriodStringException.php',
|
||||||
|
'DateMalformedStringException' => __DIR__ . '/..' . '/symfony/polyfill-php83/Resources/stubs/DateMalformedStringException.php',
|
||||||
|
'DateObjectError' => __DIR__ . '/..' . '/symfony/polyfill-php83/Resources/stubs/DateObjectError.php',
|
||||||
|
'DateRangeError' => __DIR__ . '/..' . '/symfony/polyfill-php83/Resources/stubs/DateRangeError.php',
|
||||||
|
'Override' => __DIR__ . '/..' . '/symfony/polyfill-php83/Resources/stubs/Override.php',
|
||||||
|
'SQLite3Exception' => __DIR__ . '/..' . '/symfony/polyfill-php83/Resources/stubs/SQLite3Exception.php',
|
||||||
|
);
|
||||||
|
|
||||||
|
public static function getInitializer(ClassLoader $loader)
|
||||||
|
{
|
||||||
|
return \Closure::bind(function () use ($loader) {
|
||||||
|
$loader->prefixLengthsPsr4 = ComposerStaticInit39e76b5f4d8c6722589be79886dc5716::$prefixLengthsPsr4;
|
||||||
|
$loader->prefixDirsPsr4 = ComposerStaticInit39e76b5f4d8c6722589be79886dc5716::$prefixDirsPsr4;
|
||||||
|
$loader->prefixesPsr0 = ComposerStaticInit39e76b5f4d8c6722589be79886dc5716::$prefixesPsr0;
|
||||||
|
$loader->classMap = ComposerStaticInit39e76b5f4d8c6722589be79886dc5716::$classMap;
|
||||||
|
|
||||||
|
}, null, ClassLoader::class);
|
||||||
|
}
|
||||||
|
}
|
2969
vendor/composer/installed.json
vendored
Normal file
419
vendor/composer/installed.php
vendored
Normal file
@ -0,0 +1,419 @@
|
|||||||
|
<?php return array(
|
||||||
|
'root' => array(
|
||||||
|
'name' => '__root__',
|
||||||
|
'pretty_version' => '1.0.0+no-version-set',
|
||||||
|
'version' => '1.0.0.0',
|
||||||
|
'reference' => null,
|
||||||
|
'type' => 'library',
|
||||||
|
'install_path' => __DIR__ . '/../../',
|
||||||
|
'aliases' => array(),
|
||||||
|
'dev' => true,
|
||||||
|
),
|
||||||
|
'versions' => array(
|
||||||
|
'__root__' => array(
|
||||||
|
'pretty_version' => '1.0.0+no-version-set',
|
||||||
|
'version' => '1.0.0.0',
|
||||||
|
'reference' => null,
|
||||||
|
'type' => 'library',
|
||||||
|
'install_path' => __DIR__ . '/../../',
|
||||||
|
'aliases' => array(),
|
||||||
|
'dev_requirement' => false,
|
||||||
|
),
|
||||||
|
'carbonphp/carbon-doctrine-types' => array(
|
||||||
|
'pretty_version' => '3.2.0',
|
||||||
|
'version' => '3.2.0.0',
|
||||||
|
'reference' => '18ba5ddfec8976260ead6e866180bd5d2f71aa1d',
|
||||||
|
'type' => 'library',
|
||||||
|
'install_path' => __DIR__ . '/../carbonphp/carbon-doctrine-types',
|
||||||
|
'aliases' => array(),
|
||||||
|
'dev_requirement' => false,
|
||||||
|
),
|
||||||
|
'dantsu/php-image-editor' => array(
|
||||||
|
'pretty_version' => '1.4.5',
|
||||||
|
'version' => '1.4.5.0',
|
||||||
|
'reference' => '59a3e922000767051d380a2c530c61344f1e79ec',
|
||||||
|
'type' => 'library',
|
||||||
|
'install_path' => __DIR__ . '/../dantsu/php-image-editor',
|
||||||
|
'aliases' => array(),
|
||||||
|
'dev_requirement' => false,
|
||||||
|
),
|
||||||
|
'dantsu/php-osm-static-api' => array(
|
||||||
|
'pretty_version' => '0.6.4',
|
||||||
|
'version' => '0.6.4.0',
|
||||||
|
'reference' => 'cf89dccfa4f27f6e76de0ab065b313d2f19de728',
|
||||||
|
'type' => 'library',
|
||||||
|
'install_path' => __DIR__ . '/../dantsu/php-osm-static-api',
|
||||||
|
'aliases' => array(),
|
||||||
|
'dev_requirement' => false,
|
||||||
|
),
|
||||||
|
'discord-php/http' => array(
|
||||||
|
'pretty_version' => 'v10.3.8',
|
||||||
|
'version' => '10.3.8.0',
|
||||||
|
'reference' => '0a9981dd5f8f96071f54d45e8d6fff2c6c295eb6',
|
||||||
|
'type' => 'library',
|
||||||
|
'install_path' => __DIR__ . '/../discord-php/http',
|
||||||
|
'aliases' => array(),
|
||||||
|
'dev_requirement' => false,
|
||||||
|
),
|
||||||
|
'discord/interactions' => array(
|
||||||
|
'pretty_version' => '2.2.0',
|
||||||
|
'version' => '2.2.0.0',
|
||||||
|
'reference' => 'a6fc0c877b75cf5ff5811f2ea69c5cc4ad6ac457',
|
||||||
|
'type' => 'library',
|
||||||
|
'install_path' => __DIR__ . '/../discord/interactions',
|
||||||
|
'aliases' => array(),
|
||||||
|
'dev_requirement' => false,
|
||||||
|
),
|
||||||
|
'evenement/evenement' => array(
|
||||||
|
'pretty_version' => 'v3.0.2',
|
||||||
|
'version' => '3.0.2.0',
|
||||||
|
'reference' => '0a16b0d71ab13284339abb99d9d2bd813640efbc',
|
||||||
|
'type' => 'library',
|
||||||
|
'install_path' => __DIR__ . '/../evenement/evenement',
|
||||||
|
'aliases' => array(),
|
||||||
|
'dev_requirement' => false,
|
||||||
|
),
|
||||||
|
'fig/http-message-util' => array(
|
||||||
|
'pretty_version' => '1.1.5',
|
||||||
|
'version' => '1.1.5.0',
|
||||||
|
'reference' => '9d94dc0154230ac39e5bf89398b324a86f63f765',
|
||||||
|
'type' => 'library',
|
||||||
|
'install_path' => __DIR__ . '/../fig/http-message-util',
|
||||||
|
'aliases' => array(),
|
||||||
|
'dev_requirement' => false,
|
||||||
|
),
|
||||||
|
'guzzlehttp/guzzle' => array(
|
||||||
|
'pretty_version' => '7.9.2',
|
||||||
|
'version' => '7.9.2.0',
|
||||||
|
'reference' => 'd281ed313b989f213357e3be1a179f02196ac99b',
|
||||||
|
'type' => 'library',
|
||||||
|
'install_path' => __DIR__ . '/../guzzlehttp/guzzle',
|
||||||
|
'aliases' => array(),
|
||||||
|
'dev_requirement' => false,
|
||||||
|
),
|
||||||
|
'guzzlehttp/promises' => array(
|
||||||
|
'pretty_version' => '2.0.4',
|
||||||
|
'version' => '2.0.4.0',
|
||||||
|
'reference' => 'f9c436286ab2892c7db7be8c8da4ef61ccf7b455',
|
||||||
|
'type' => 'library',
|
||||||
|
'install_path' => __DIR__ . '/../guzzlehttp/promises',
|
||||||
|
'aliases' => array(),
|
||||||
|
'dev_requirement' => false,
|
||||||
|
),
|
||||||
|
'guzzlehttp/psr7' => array(
|
||||||
|
'pretty_version' => '2.7.0',
|
||||||
|
'version' => '2.7.0.0',
|
||||||
|
'reference' => 'a70f5c95fb43bc83f07c9c948baa0dc1829bf201',
|
||||||
|
'type' => 'library',
|
||||||
|
'install_path' => __DIR__ . '/../guzzlehttp/psr7',
|
||||||
|
'aliases' => array(),
|
||||||
|
'dev_requirement' => false,
|
||||||
|
),
|
||||||
|
'monolog/monolog' => array(
|
||||||
|
'pretty_version' => '3.8.1',
|
||||||
|
'version' => '3.8.1.0',
|
||||||
|
'reference' => 'aef6ee73a77a66e404dd6540934a9ef1b3c855b4',
|
||||||
|
'type' => 'library',
|
||||||
|
'install_path' => __DIR__ . '/../monolog/monolog',
|
||||||
|
'aliases' => array(),
|
||||||
|
'dev_requirement' => false,
|
||||||
|
),
|
||||||
|
'nesbot/carbon' => array(
|
||||||
|
'pretty_version' => '3.8.4',
|
||||||
|
'version' => '3.8.4.0',
|
||||||
|
'reference' => '129700ed449b1f02d70272d2ac802357c8c30c58',
|
||||||
|
'type' => 'library',
|
||||||
|
'install_path' => __DIR__ . '/../nesbot/carbon',
|
||||||
|
'aliases' => array(),
|
||||||
|
'dev_requirement' => false,
|
||||||
|
),
|
||||||
|
'psr/clock' => array(
|
||||||
|
'pretty_version' => '1.0.0',
|
||||||
|
'version' => '1.0.0.0',
|
||||||
|
'reference' => 'e41a24703d4560fd0acb709162f73b8adfc3aa0d',
|
||||||
|
'type' => 'library',
|
||||||
|
'install_path' => __DIR__ . '/../psr/clock',
|
||||||
|
'aliases' => array(),
|
||||||
|
'dev_requirement' => false,
|
||||||
|
),
|
||||||
|
'psr/clock-implementation' => array(
|
||||||
|
'dev_requirement' => false,
|
||||||
|
'provided' => array(
|
||||||
|
0 => '1.0',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'psr/http-client' => array(
|
||||||
|
'pretty_version' => '1.0.3',
|
||||||
|
'version' => '1.0.3.0',
|
||||||
|
'reference' => 'bb5906edc1c324c9a05aa0873d40117941e5fa90',
|
||||||
|
'type' => 'library',
|
||||||
|
'install_path' => __DIR__ . '/../psr/http-client',
|
||||||
|
'aliases' => array(),
|
||||||
|
'dev_requirement' => false,
|
||||||
|
),
|
||||||
|
'psr/http-client-implementation' => array(
|
||||||
|
'dev_requirement' => false,
|
||||||
|
'provided' => array(
|
||||||
|
0 => '1.0',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'psr/http-factory' => array(
|
||||||
|
'pretty_version' => '1.1.0',
|
||||||
|
'version' => '1.1.0.0',
|
||||||
|
'reference' => '2b4765fddfe3b508ac62f829e852b1501d3f6e8a',
|
||||||
|
'type' => 'library',
|
||||||
|
'install_path' => __DIR__ . '/../psr/http-factory',
|
||||||
|
'aliases' => array(),
|
||||||
|
'dev_requirement' => false,
|
||||||
|
),
|
||||||
|
'psr/http-factory-implementation' => array(
|
||||||
|
'dev_requirement' => false,
|
||||||
|
'provided' => array(
|
||||||
|
0 => '1.0',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'psr/http-message' => array(
|
||||||
|
'pretty_version' => '1.1',
|
||||||
|
'version' => '1.1.0.0',
|
||||||
|
'reference' => 'cb6ce4845ce34a8ad9e68117c10ee90a29919eba',
|
||||||
|
'type' => 'library',
|
||||||
|
'install_path' => __DIR__ . '/../psr/http-message',
|
||||||
|
'aliases' => array(),
|
||||||
|
'dev_requirement' => false,
|
||||||
|
),
|
||||||
|
'psr/http-message-implementation' => array(
|
||||||
|
'dev_requirement' => false,
|
||||||
|
'provided' => array(
|
||||||
|
0 => '1.0',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'psr/log' => array(
|
||||||
|
'pretty_version' => '3.0.2',
|
||||||
|
'version' => '3.0.2.0',
|
||||||
|
'reference' => 'f16e1d5863e37f8d8c2a01719f5b34baa2b714d3',
|
||||||
|
'type' => 'library',
|
||||||
|
'install_path' => __DIR__ . '/../psr/log',
|
||||||
|
'aliases' => array(),
|
||||||
|
'dev_requirement' => false,
|
||||||
|
),
|
||||||
|
'psr/log-implementation' => array(
|
||||||
|
'dev_requirement' => false,
|
||||||
|
'provided' => array(
|
||||||
|
0 => '3.0.0',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'psr/simple-cache' => array(
|
||||||
|
'pretty_version' => '3.0.0',
|
||||||
|
'version' => '3.0.0.0',
|
||||||
|
'reference' => '764e0b3939f5ca87cb904f570ef9be2d78a07865',
|
||||||
|
'type' => 'library',
|
||||||
|
'install_path' => __DIR__ . '/../psr/simple-cache',
|
||||||
|
'aliases' => array(),
|
||||||
|
'dev_requirement' => false,
|
||||||
|
),
|
||||||
|
'ralouphie/getallheaders' => array(
|
||||||
|
'pretty_version' => '3.0.3',
|
||||||
|
'version' => '3.0.3.0',
|
||||||
|
'reference' => '120b605dfeb996808c31b6477290a714d356e822',
|
||||||
|
'type' => 'library',
|
||||||
|
'install_path' => __DIR__ . '/../ralouphie/getallheaders',
|
||||||
|
'aliases' => array(),
|
||||||
|
'dev_requirement' => false,
|
||||||
|
),
|
||||||
|
'ratchet/pawl' => array(
|
||||||
|
'pretty_version' => 'v0.4.1',
|
||||||
|
'version' => '0.4.1.0',
|
||||||
|
'reference' => 'af70198bab77a582b31169d3cc3982bed25c161f',
|
||||||
|
'type' => 'library',
|
||||||
|
'install_path' => __DIR__ . '/../ratchet/pawl',
|
||||||
|
'aliases' => array(),
|
||||||
|
'dev_requirement' => false,
|
||||||
|
),
|
||||||
|
'ratchet/rfc6455' => array(
|
||||||
|
'pretty_version' => 'v0.3.1',
|
||||||
|
'version' => '0.3.1.0',
|
||||||
|
'reference' => '7c964514e93456a52a99a20fcfa0de242a43ccdb',
|
||||||
|
'type' => 'library',
|
||||||
|
'install_path' => __DIR__ . '/../ratchet/rfc6455',
|
||||||
|
'aliases' => array(),
|
||||||
|
'dev_requirement' => false,
|
||||||
|
),
|
||||||
|
'react/async' => array(
|
||||||
|
'pretty_version' => 'v4.3.0',
|
||||||
|
'version' => '4.3.0.0',
|
||||||
|
'reference' => '635d50e30844a484495713e8cb8d9e079c0008a5',
|
||||||
|
'type' => 'library',
|
||||||
|
'install_path' => __DIR__ . '/../react/async',
|
||||||
|
'aliases' => array(),
|
||||||
|
'dev_requirement' => false,
|
||||||
|
),
|
||||||
|
'react/cache' => array(
|
||||||
|
'pretty_version' => 'v1.2.0',
|
||||||
|
'version' => '1.2.0.0',
|
||||||
|
'reference' => 'd47c472b64aa5608225f47965a484b75c7817d5b',
|
||||||
|
'type' => 'library',
|
||||||
|
'install_path' => __DIR__ . '/../react/cache',
|
||||||
|
'aliases' => array(),
|
||||||
|
'dev_requirement' => false,
|
||||||
|
),
|
||||||
|
'react/child-process' => array(
|
||||||
|
'pretty_version' => 'v0.6.6',
|
||||||
|
'version' => '0.6.6.0',
|
||||||
|
'reference' => '1721e2b93d89b745664353b9cfc8f155ba8a6159',
|
||||||
|
'type' => 'library',
|
||||||
|
'install_path' => __DIR__ . '/../react/child-process',
|
||||||
|
'aliases' => array(),
|
||||||
|
'dev_requirement' => false,
|
||||||
|
),
|
||||||
|
'react/datagram' => array(
|
||||||
|
'pretty_version' => 'v1.10.0',
|
||||||
|
'version' => '1.10.0.0',
|
||||||
|
'reference' => '9236e1f5a67a6029be17d551e9858c487836c301',
|
||||||
|
'type' => 'library',
|
||||||
|
'install_path' => __DIR__ . '/../react/datagram',
|
||||||
|
'aliases' => array(),
|
||||||
|
'dev_requirement' => false,
|
||||||
|
),
|
||||||
|
'react/dns' => array(
|
||||||
|
'pretty_version' => 'v1.13.0',
|
||||||
|
'version' => '1.13.0.0',
|
||||||
|
'reference' => 'eb8ae001b5a455665c89c1df97f6fb682f8fb0f5',
|
||||||
|
'type' => 'library',
|
||||||
|
'install_path' => __DIR__ . '/../react/dns',
|
||||||
|
'aliases' => array(),
|
||||||
|
'dev_requirement' => false,
|
||||||
|
),
|
||||||
|
'react/event-loop' => array(
|
||||||
|
'pretty_version' => 'v1.5.0',
|
||||||
|
'version' => '1.5.0.0',
|
||||||
|
'reference' => 'bbe0bd8c51ffc05ee43f1729087ed3bdf7d53354',
|
||||||
|
'type' => 'library',
|
||||||
|
'install_path' => __DIR__ . '/../react/event-loop',
|
||||||
|
'aliases' => array(),
|
||||||
|
'dev_requirement' => false,
|
||||||
|
),
|
||||||
|
'react/http' => array(
|
||||||
|
'pretty_version' => 'v1.11.0',
|
||||||
|
'version' => '1.11.0.0',
|
||||||
|
'reference' => '8db02de41dcca82037367f67a2d4be365b1c4db9',
|
||||||
|
'type' => 'library',
|
||||||
|
'install_path' => __DIR__ . '/../react/http',
|
||||||
|
'aliases' => array(),
|
||||||
|
'dev_requirement' => false,
|
||||||
|
),
|
||||||
|
'react/promise' => array(
|
||||||
|
'pretty_version' => 'v3.2.0',
|
||||||
|
'version' => '3.2.0.0',
|
||||||
|
'reference' => '8a164643313c71354582dc850b42b33fa12a4b63',
|
||||||
|
'type' => 'library',
|
||||||
|
'install_path' => __DIR__ . '/../react/promise',
|
||||||
|
'aliases' => array(),
|
||||||
|
'dev_requirement' => false,
|
||||||
|
),
|
||||||
|
'react/socket' => array(
|
||||||
|
'pretty_version' => 'v1.16.0',
|
||||||
|
'version' => '1.16.0.0',
|
||||||
|
'reference' => '23e4ff33ea3e160d2d1f59a0e6050e4b0fb0eac1',
|
||||||
|
'type' => 'library',
|
||||||
|
'install_path' => __DIR__ . '/../react/socket',
|
||||||
|
'aliases' => array(),
|
||||||
|
'dev_requirement' => false,
|
||||||
|
),
|
||||||
|
'react/stream' => array(
|
||||||
|
'pretty_version' => 'v1.4.0',
|
||||||
|
'version' => '1.4.0.0',
|
||||||
|
'reference' => '1e5b0acb8fe55143b5b426817155190eb6f5b18d',
|
||||||
|
'type' => 'library',
|
||||||
|
'install_path' => __DIR__ . '/../react/stream',
|
||||||
|
'aliases' => array(),
|
||||||
|
'dev_requirement' => false,
|
||||||
|
),
|
||||||
|
'symfony/clock' => array(
|
||||||
|
'pretty_version' => 'v7.2.0',
|
||||||
|
'version' => '7.2.0.0',
|
||||||
|
'reference' => 'b81435fbd6648ea425d1ee96a2d8e68f4ceacd24',
|
||||||
|
'type' => 'library',
|
||||||
|
'install_path' => __DIR__ . '/../symfony/clock',
|
||||||
|
'aliases' => array(),
|
||||||
|
'dev_requirement' => false,
|
||||||
|
),
|
||||||
|
'symfony/deprecation-contracts' => array(
|
||||||
|
'pretty_version' => 'v3.5.1',
|
||||||
|
'version' => '3.5.1.0',
|
||||||
|
'reference' => '74c71c939a79f7d5bf3c1ce9f5ea37ba0114c6f6',
|
||||||
|
'type' => 'library',
|
||||||
|
'install_path' => __DIR__ . '/../symfony/deprecation-contracts',
|
||||||
|
'aliases' => array(),
|
||||||
|
'dev_requirement' => false,
|
||||||
|
),
|
||||||
|
'symfony/options-resolver' => array(
|
||||||
|
'pretty_version' => 'v7.2.0',
|
||||||
|
'version' => '7.2.0.0',
|
||||||
|
'reference' => '7da8fbac9dcfef75ffc212235d76b2754ce0cf50',
|
||||||
|
'type' => 'library',
|
||||||
|
'install_path' => __DIR__ . '/../symfony/options-resolver',
|
||||||
|
'aliases' => array(),
|
||||||
|
'dev_requirement' => false,
|
||||||
|
),
|
||||||
|
'symfony/polyfill-mbstring' => array(
|
||||||
|
'pretty_version' => 'v1.31.0',
|
||||||
|
'version' => '1.31.0.0',
|
||||||
|
'reference' => '85181ba99b2345b0ef10ce42ecac37612d9fd341',
|
||||||
|
'type' => 'library',
|
||||||
|
'install_path' => __DIR__ . '/../symfony/polyfill-mbstring',
|
||||||
|
'aliases' => array(),
|
||||||
|
'dev_requirement' => false,
|
||||||
|
),
|
||||||
|
'symfony/polyfill-php83' => array(
|
||||||
|
'pretty_version' => 'v1.31.0',
|
||||||
|
'version' => '1.31.0.0',
|
||||||
|
'reference' => '2fb86d65e2d424369ad2905e83b236a8805ba491',
|
||||||
|
'type' => 'library',
|
||||||
|
'install_path' => __DIR__ . '/../symfony/polyfill-php83',
|
||||||
|
'aliases' => array(),
|
||||||
|
'dev_requirement' => false,
|
||||||
|
),
|
||||||
|
'symfony/translation' => array(
|
||||||
|
'pretty_version' => 'v7.2.2',
|
||||||
|
'version' => '7.2.2.0',
|
||||||
|
'reference' => 'e2674a30132b7cc4d74540d6c2573aa363f05923',
|
||||||
|
'type' => 'library',
|
||||||
|
'install_path' => __DIR__ . '/../symfony/translation',
|
||||||
|
'aliases' => array(),
|
||||||
|
'dev_requirement' => false,
|
||||||
|
),
|
||||||
|
'symfony/translation-contracts' => array(
|
||||||
|
'pretty_version' => 'v3.5.1',
|
||||||
|
'version' => '3.5.1.0',
|
||||||
|
'reference' => '4667ff3bd513750603a09c8dedbea942487fb07c',
|
||||||
|
'type' => 'library',
|
||||||
|
'install_path' => __DIR__ . '/../symfony/translation-contracts',
|
||||||
|
'aliases' => array(),
|
||||||
|
'dev_requirement' => false,
|
||||||
|
),
|
||||||
|
'symfony/translation-implementation' => array(
|
||||||
|
'dev_requirement' => false,
|
||||||
|
'provided' => array(
|
||||||
|
0 => '2.3|3.0',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'team-reflex/discord-php' => array(
|
||||||
|
'pretty_version' => 'v10.1.5',
|
||||||
|
'version' => '10.1.5.0',
|
||||||
|
'reference' => '23d1347025a7aa57e2a6918080bf2e1eaf1f0181',
|
||||||
|
'type' => 'library',
|
||||||
|
'install_path' => __DIR__ . '/../team-reflex/discord-php',
|
||||||
|
'aliases' => array(),
|
||||||
|
'dev_requirement' => false,
|
||||||
|
),
|
||||||
|
'trafficcophp/bytebuffer' => array(
|
||||||
|
'pretty_version' => 'v0.3',
|
||||||
|
'version' => '0.3.0.0',
|
||||||
|
'reference' => 'e94e5c87c41bc79c0f738b0fa89bad11d27ae0b4',
|
||||||
|
'type' => 'library',
|
||||||
|
'install_path' => __DIR__ . '/../trafficcophp/bytebuffer',
|
||||||
|
'aliases' => array(),
|
||||||
|
'dev_requirement' => false,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
26
vendor/composer/platform_check.php
vendored
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
// platform_check.php @generated by Composer
|
||||||
|
|
||||||
|
$issues = array();
|
||||||
|
|
||||||
|
if (!(PHP_VERSION_ID >= 80200)) {
|
||||||
|
$issues[] = 'Your Composer dependencies require a PHP version ">= 8.2.0". You are running ' . PHP_VERSION . '.';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($issues) {
|
||||||
|
if (!headers_sent()) {
|
||||||
|
header('HTTP/1.1 500 Internal Server Error');
|
||||||
|
}
|
||||||
|
if (!ini_get('display_errors')) {
|
||||||
|
if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
|
||||||
|
fwrite(STDERR, 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . implode(PHP_EOL, $issues) . PHP_EOL.PHP_EOL);
|
||||||
|
} elseif (!headers_sent()) {
|
||||||
|
echo 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . str_replace('You are running '.PHP_VERSION.'.', '', implode(PHP_EOL, $issues)) . PHP_EOL.PHP_EOL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
trigger_error(
|
||||||
|
'Composer detected issues in your platform: ' . implode(' ', $issues),
|
||||||
|
E_USER_ERROR
|
||||||
|
);
|
||||||
|
}
|
1
vendor/dantsu/php-image-editor/.github/FUNDING.yml
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
github: DantSu
|
6
vendor/dantsu/php-image-editor/.gitignore
vendored
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
/.idea
|
||||||
|
/.phpdoc
|
||||||
|
/phpdoc.xml
|
||||||
|
/phpdocumentor
|
||||||
|
/vendor
|
||||||
|
/composer.lock
|
21
vendor/dantsu/php-image-editor/LICENSE
vendored
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2021 Franck ALARY
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
83
vendor/dantsu/php-image-editor/README.md
vendored
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
[![Packagist](https://img.shields.io/packagist/dt/DantSu/php-image-editor.svg)](https://packagist.org/packages/DantSu/php-image-editor)
|
||||||
|
[![Latest Stable Version](https://poser.pugx.org/DantSu/php-image-editor/v/stable)](https://packagist.org/packages/DantSu/php-image-editor)
|
||||||
|
[![GitHub license](https://img.shields.io/github/license/DantSu/php-image-editor.svg)](https://github.com/DantSu/php-image-editor/blob/master/LICENSE)
|
||||||
|
|
||||||
|
# PHP Image Editor
|
||||||
|
|
||||||
|
PHP library to easily edit image with GD extension. Resize, crop, merge, draw, and many more options !
|
||||||
|
|
||||||
|
## ✨ Supporting
|
||||||
|
|
||||||
|
⭐ Star this repository to support this project. You will contribute to increase the visibility of this library 🙂
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
Install this library easily with composer :
|
||||||
|
|
||||||
|
```cmd
|
||||||
|
composer require dantsu/php-image-editor
|
||||||
|
```
|
||||||
|
|
||||||
|
## How to use
|
||||||
|
|
||||||
|
### Example 1
|
||||||
|
|
||||||
|
Create a empty image, draw on it and display it :
|
||||||
|
|
||||||
|
```php
|
||||||
|
use \DantSu\PHPImageEditor\Image;
|
||||||
|
|
||||||
|
\header('Content-type: image/png');
|
||||||
|
|
||||||
|
$image = Image::newCanvas(500, 500)
|
||||||
|
->drawRectangle(0, 0, 500, 500, '#444')
|
||||||
|
->drawRectangle(0, 350, 500, 500, '#FF8800')
|
||||||
|
->writeText('I got the power !', __DIR__ . '/resources/font.ttf', 40, '#FFFFFF', Image::ALIGN_CENTER, 310)
|
||||||
|
->drawCircle(25, 100, 100, '#FF8800')
|
||||||
|
->drawCircle(25, 100, 95, '#000000FF')
|
||||||
|
->drawCircle(475, 100, 100, '#FF8800')
|
||||||
|
->drawCircle(475, 100, 95, '#000000FF');
|
||||||
|
|
||||||
|
for($i = 0; $i <= 360; $i+=30) {
|
||||||
|
$image
|
||||||
|
->drawArrowWithAngle(250, 200, $i, 80, 2, '#FF8800')
|
||||||
|
->drawArrowWithAngle(250, 200, ($i + 15), 50, 2, '#FF8800');
|
||||||
|
}
|
||||||
|
|
||||||
|
$image
|
||||||
|
->crop(450, 300, Image::ALIGN_CENTER, Image::ALIGN_MIDDLE)
|
||||||
|
->displayPNG();
|
||||||
|
```
|
||||||
|
|
||||||
|
![Sample 1](./src/samples/resources/sample1.png)
|
||||||
|
|
||||||
|
|
||||||
|
### Example 2
|
||||||
|
|
||||||
|
Apply a watermark on a photo and save it :
|
||||||
|
|
||||||
|
```php
|
||||||
|
use \DantSu\PHPImageEditor\Image;
|
||||||
|
|
||||||
|
Image::fromPath(__DIR__ . '/resources/photo.jpg')
|
||||||
|
->downscaleAndCrop(1920, 1080, Image::ALIGN_CENTER, Image::ALIGN_BOTTOM)
|
||||||
|
->pasteOn(
|
||||||
|
Image::fromPath(__DIR__ . '/resources/watermark.png')->downscaleProportion(300, 300),
|
||||||
|
Image::ALIGN_RIGHT,
|
||||||
|
Image::ALIGN_TOP
|
||||||
|
)
|
||||||
|
->saveJPG(__DIR__ . '/my-image.jpg', 70);
|
||||||
|
```
|
||||||
|
|
||||||
|
![Sample 2](./src/samples/resources/sample2.jpg)
|
||||||
|
|
||||||
|
## Documentation
|
||||||
|
|
||||||
|
See [DantSu\PHPImageEditor\Image](./docs/classes/DantSu/PHPImageEditor/Image.md) documentation class for more details.
|
||||||
|
|
||||||
|
## Contributing
|
||||||
|
|
||||||
|
Please fork this repository and contribute back using pull requests.
|
||||||
|
|
||||||
|
Any contributions, large or small, major features, bug fixes, are welcomed and appreciated but will be thoroughly reviewed.
|
||||||
|
|
33
vendor/dantsu/php-image-editor/composer.json
vendored
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
{
|
||||||
|
"name": "dantsu/php-image-editor",
|
||||||
|
"type": "library",
|
||||||
|
"description": "PHP library to easily edit image with GD extension.",
|
||||||
|
"keywords": [
|
||||||
|
"php",
|
||||||
|
"gd2",
|
||||||
|
"edit",
|
||||||
|
"edition",
|
||||||
|
"editor",
|
||||||
|
"image",
|
||||||
|
"picture",
|
||||||
|
"photo"
|
||||||
|
],
|
||||||
|
"homepage": "https://github.com/DantSu/php-image-editor",
|
||||||
|
"license": "MIT",
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Franck ALARY",
|
||||||
|
"homepage": "https://github.com/DantSu",
|
||||||
|
"role": "Developer"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"require": {
|
||||||
|
"php": ">=7.0",
|
||||||
|
"ext-gd": "*"
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"DantSu\\PHPImageEditor\\": "src/"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
1439
vendor/dantsu/php-image-editor/docs/classes/DantSu/PHPImageEditor/Image.md
vendored
Normal file
22
vendor/dantsu/php-image-editor/docs/index.md
vendored
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
|
||||||
|
# PHP Image Editor
|
||||||
|
|
||||||
|
This is an automatically generated documentation for **PHP Image Editor**.
|
||||||
|
|
||||||
|
|
||||||
|
## Namespaces
|
||||||
|
|
||||||
|
|
||||||
|
### \DantSu\PHPImageEditor
|
||||||
|
|
||||||
|
#### Classes
|
||||||
|
|
||||||
|
| Class | Description |
|
||||||
|
|--- |--- |
|
||||||
|
| [Image](./classes/DantSu/PHPImageEditor/Image.md) | DantSu\PHPImageEditor\Image is PHP library to easily edit image with GD extension. Resize, crop, merge, draw, and many more options !|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
> Automatically generated from source code comments on 2022-11-09 using [phpDocumentor](http://www.phpdoc.org/)
|
61
vendor/dantsu/php-image-editor/src/Geometry2D.php
vendored
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace DantSu\PHPImageEditor;
|
||||||
|
|
||||||
|
class Geometry2D
|
||||||
|
{
|
||||||
|
public static function degrees0to360(float $angle): float
|
||||||
|
{
|
||||||
|
while ($angle < 0 || $angle >= 360) {
|
||||||
|
if ($angle < 0) $angle += 360;
|
||||||
|
elseif ($angle >= 360) $angle -= 360;
|
||||||
|
}
|
||||||
|
return $angle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getDstXY(float $originX, float $originY, float $angle, float $length): array
|
||||||
|
{
|
||||||
|
$angle = 360 - $angle;
|
||||||
|
return [
|
||||||
|
'x' => $originX + \cos($angle * M_PI / 180) * $length,
|
||||||
|
'y' => $originY + \sin($angle * M_PI / 180) * $length
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getDstXYRounded(float $originX, float $originY, float $angle, float $length): array
|
||||||
|
{
|
||||||
|
$xy = Geometry2D::getDstXY($originX, $originY, $angle, $length);
|
||||||
|
return [
|
||||||
|
'x' => \round($xy['x']),
|
||||||
|
'y' => \round($xy['y'])
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getAngleAndLengthFromPoints(float $originX, float $originY, float $dstX, float $dstY): array
|
||||||
|
{
|
||||||
|
$width = $dstX - $originX;
|
||||||
|
$height = $dstY - $originY;
|
||||||
|
$diameter = \sqrt(\pow($width, 2) + \pow($height, 2));
|
||||||
|
|
||||||
|
if($width == 0) {
|
||||||
|
$angle = 90;
|
||||||
|
} elseif ($height == 0) {
|
||||||
|
$angle = 0;
|
||||||
|
} else {
|
||||||
|
$angle = \atan2(\abs($height), \abs($width)) * 180.0 / M_PI;
|
||||||
|
}
|
||||||
|
|
||||||
|
if($width < 0 && $height < 0) {
|
||||||
|
$angle += 180;
|
||||||
|
} elseif ($width < 0) {
|
||||||
|
$angle = 180 - $angle;
|
||||||
|
} elseif ($height < 0) {
|
||||||
|
$angle = 360 - $angle;
|
||||||
|
}
|
||||||
|
|
||||||
|
return [
|
||||||
|
'angle' => 360 - $angle,
|
||||||
|
'length' => $diameter
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
1418
vendor/dantsu/php-image-editor/src/Image.php
vendored
Normal file
BIN
vendor/dantsu/php-image-editor/src/samples/resources/font.ttf
vendored
Normal file
BIN
vendor/dantsu/php-image-editor/src/samples/resources/photo.jpg
vendored
Normal file
After Width: | Height: | Size: 361 KiB |
BIN
vendor/dantsu/php-image-editor/src/samples/resources/sample1.png
vendored
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
vendor/dantsu/php-image-editor/src/samples/resources/sample2.jpg
vendored
Normal file
After Width: | Height: | Size: 92 KiB |
BIN
vendor/dantsu/php-image-editor/src/samples/resources/sample5_base.png
vendored
Normal file
After Width: | Height: | Size: 5.8 KiB |
BIN
vendor/dantsu/php-image-editor/src/samples/resources/sample5_mask.png
vendored
Normal file
After Width: | Height: | Size: 6.0 KiB |
BIN
vendor/dantsu/php-image-editor/src/samples/resources/watermark.png
vendored
Normal file
After Width: | Height: | Size: 49 KiB |
28
vendor/dantsu/php-image-editor/src/samples/sample1.php
vendored
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once '../Geometry2D.php';
|
||||||
|
require_once '../Image.php';
|
||||||
|
|
||||||
|
use \DantSu\PHPImageEditor\Image;
|
||||||
|
|
||||||
|
\header('Content-type: image/png');
|
||||||
|
|
||||||
|
$image = Image::newCanvas(500, 500)
|
||||||
|
->drawRectangle(0, 0, 500, 500, '#444')
|
||||||
|
->drawRectangle(0, 350, 500, 500, '#FF8800')
|
||||||
|
->writeText('I got the power !', __DIR__ . '/resources/font.ttf', 40, '#FFFFFF', Image::ALIGN_CENTER, 310)
|
||||||
|
->drawCircle(25, 100, 100, '#FF8800')
|
||||||
|
->drawCircle(25, 100, 95, '#000000FF')
|
||||||
|
->drawCircle(475, 100, 100, '#FF8800')
|
||||||
|
->drawCircle(475, 100, 95, '#000000FF');
|
||||||
|
|
||||||
|
for($i = 0; $i <= 360; $i+=30) {
|
||||||
|
$image
|
||||||
|
->drawArrowWithAngle(250, 200, $i, 80, 2, '#FF8800')
|
||||||
|
->drawArrowWithAngle(250, 200, ($i + 15), 50, 2, '#FF8800');
|
||||||
|
}
|
||||||
|
|
||||||
|
$image
|
||||||
|
->crop(450, 300)
|
||||||
|
->displayPNG();
|
||||||
|
|
18
vendor/dantsu/php-image-editor/src/samples/sample2.php
vendored
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once '../Geometry2D.php';
|
||||||
|
require_once '../Image.php';
|
||||||
|
|
||||||
|
use \DantSu\PHPImageEditor\Image;
|
||||||
|
|
||||||
|
\header('Content-type: image/jpg');
|
||||||
|
|
||||||
|
Image::fromPath(__DIR__ . '/resources/photo.jpg')
|
||||||
|
->downscaleAndCrop(1920, 1080, Image::ALIGN_CENTER, Image::ALIGN_BOTTOM)
|
||||||
|
->pasteOn(
|
||||||
|
Image::fromPath(__DIR__ . '/resources/watermark.png')->downscaleProportion(300, 300),
|
||||||
|
Image::ALIGN_RIGHT,
|
||||||
|
Image::ALIGN_TOP
|
||||||
|
)
|
||||||
|
->displayJPG(50);
|
||||||
|
|
19
vendor/dantsu/php-image-editor/src/samples/sample3.php
vendored
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once '../Geometry2D.php';
|
||||||
|
require_once '../Image.php';
|
||||||
|
|
||||||
|
use \DantSu\PHPImageEditor\Image;
|
||||||
|
|
||||||
|
\header('Content-type: image/png');
|
||||||
|
|
||||||
|
$image = Image::fromPath(__DIR__ . '/resources/photo.jpg')->downscaleAndCrop(512, 1024);
|
||||||
|
|
||||||
|
$image2 = clone $image;
|
||||||
|
$image2->drawRectangle(128, 128, 384, 384, '#8822AA');
|
||||||
|
|
||||||
|
Image::newCanvas(1024, 1024)
|
||||||
|
->pasteOn($image, 0, 0)
|
||||||
|
->pasteOn($image2, 512, 0)
|
||||||
|
->displayPNG();
|
||||||
|
|
23
vendor/dantsu/php-image-editor/src/samples/sample4.php
vendored
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
require_once '../Geometry2D.php';
|
||||||
|
require_once '../Image.php';
|
||||||
|
|
||||||
|
use \DantSu\PHPImageEditor\Image;
|
||||||
|
|
||||||
|
\header('Content-type: image/png');
|
||||||
|
|
||||||
|
Image::fromPath(__DIR__ . '/resources/photo.jpg')
|
||||||
|
->downscaleAndCrop(1920, 1080, Image::ALIGN_CENTER, Image::ALIGN_BOTTOM)
|
||||||
|
->drawPolygon([110, 500, 240, 250, 400, 140, 650, 280, 400, 400, 800, 510, 400, 950, 180, 620, 230, 540], '#88229988')
|
||||||
|
->drawCircle(450, 600, 200, '#FFFFFF88')
|
||||||
|
->pasteOn(
|
||||||
|
Image::newCanvas(1920, 1080)
|
||||||
|
->drawPolygon([1110, 500, 1240, 250, 1400, 140, 1650, 280, 1400, 400, 1800, 510, 1400, 950, 1180, 620, 1230, 540], '#882299')
|
||||||
|
->drawCircle(1450, 600, 200)
|
||||||
|
->setOpacity(0.6),
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
)
|
||||||
|
->displayPNG();
|
14
vendor/dantsu/php-image-editor/src/samples/sample5.php
vendored
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once '../Geometry2D.php';
|
||||||
|
require_once '../Image.php';
|
||||||
|
|
||||||
|
use \DantSu\PHPImageEditor\Image;
|
||||||
|
|
||||||
|
\header('Content-type: image/png');
|
||||||
|
|
||||||
|
Image::fromPath(__DIR__ . '/resources/sample5_base.png')
|
||||||
|
->alphaMask(Image::fromPath(__DIR__ . '/resources/sample5_mask.png'))
|
||||||
|
->crop(494, 494, 9, 12)
|
||||||
|
->setOpacity(0.5)
|
||||||
|
->displayPNG();
|
24
vendor/dantsu/php-image-editor/src/samples/sample6.php
vendored
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once '../Geometry2D.php';
|
||||||
|
require_once '../Image.php';
|
||||||
|
|
||||||
|
use \DantSu\PHPImageEditor\Image;
|
||||||
|
|
||||||
|
\header('Content-type: image/png');
|
||||||
|
|
||||||
|
$image1 = Image::newCanvas(500, 500);
|
||||||
|
$bbox = $image1->writeTextAndGetBoundingBox('I got the power !', __DIR__ . '/resources/font.ttf', 40, '#FFFFFF', Image::ALIGN_RIGHT, Image::ALIGN_BOTTOM, Image::ALIGN_RIGHT, Image::ALIGN_BOTTOM, 0, 5);
|
||||||
|
|
||||||
|
Image::newCanvas(500, 500)
|
||||||
|
->drawPolygon(
|
||||||
|
[
|
||||||
|
$bbox['top-left']['x'], $bbox['top-left']['y'],
|
||||||
|
$bbox['top-right']['x'], $bbox['top-right']['y'],
|
||||||
|
$bbox['bottom-right']['x'], $bbox['bottom-right']['y'],
|
||||||
|
$bbox['bottom-left']['x'], $bbox['bottom-left']['y']
|
||||||
|
],
|
||||||
|
'00000088'
|
||||||
|
)
|
||||||
|
->pasteOn($image1)
|
||||||
|
->displayPNG();
|
1
vendor/dantsu/php-osm-static-api/.github/FUNDING.yml
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
github: DantSu
|
6
vendor/dantsu/php-osm-static-api/.gitignore
vendored
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
/.idea
|
||||||
|
/.phpdoc
|
||||||
|
/phpdoc.xml
|
||||||
|
/phpdocumentor
|
||||||
|
/vendor
|
||||||
|
/composer.lock
|
21
vendor/dantsu/php-osm-static-api/LICENSE
vendored
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2021 Franck ALARY
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
77
vendor/dantsu/php-osm-static-api/README.md
vendored
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
[![Packagist](https://img.shields.io/packagist/dt/DantSu/php-osm-static-api.svg)](https://packagist.org/packages/DantSu/php-osm-static-api)
|
||||||
|
[![Latest Stable Version](https://poser.pugx.org/DantSu/php-osm-static-api/v/stable)](https://packagist.org/packages/DantSu/php-osm-static-api)
|
||||||
|
[![GitHub license](https://img.shields.io/github/license/DantSu/php-osm-static-api.svg)](https://github.com/DantSu/php-osm-static-api/blob/master/LICENSE)
|
||||||
|
|
||||||
|
# PHP OpenStreetMap Static API
|
||||||
|
|
||||||
|
PHP library to easily get static image from OpenStreetMap with markers, lines, circles and polygons.
|
||||||
|
|
||||||
|
This project uses the [Tile Server](https://wiki.openstreetmap.org/wiki/Tile_servers) of the OpenStreetMap Foundation which runs entirely on donated resources, see [Tile Usage Policy](https://operations.osmfoundation.org/policies/tiles/) for more information.
|
||||||
|
|
||||||
|
## ✨ Supporting
|
||||||
|
|
||||||
|
⭐ Star this repository to support this project. You will contribute to increase the visibility of this library 🙂
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
Install this library easily with composer :
|
||||||
|
|
||||||
|
```cmd
|
||||||
|
composer require dantsu/php-osm-static-api
|
||||||
|
```
|
||||||
|
|
||||||
|
## How to use
|
||||||
|
|
||||||
|
Generate OpenStreetMap static image with marker and line :
|
||||||
|
|
||||||
|
```php
|
||||||
|
use \DantSu\OpenStreetMapStaticAPI\OpenStreetMap;
|
||||||
|
use \DantSu\OpenStreetMapStaticAPI\LatLng;
|
||||||
|
use \DantSu\OpenStreetMapStaticAPI\Polygon;
|
||||||
|
use \DantSu\OpenStreetMapStaticAPI\Markers;
|
||||||
|
|
||||||
|
\header('Content-type: image/png');
|
||||||
|
(new OpenStreetMap(new LatLng(44.351933, 2.568113), 17, 600, 400))
|
||||||
|
->addMarkers(
|
||||||
|
(new Markers(__DIR__ . '/resources/marker.png'))
|
||||||
|
->setAnchor(Markers::ANCHOR_CENTER, Markers::ANCHOR_BOTTOM)
|
||||||
|
->addMarker(new LatLng(44.351933, 2.568113))
|
||||||
|
->addMarker(new LatLng(44.351510, 2.570020))
|
||||||
|
->addMarker(new LatLng(44.351873, 2.566250))
|
||||||
|
)
|
||||||
|
->addDraw(
|
||||||
|
(new Polygon('FF0000', 2, 'FF0000DD'))
|
||||||
|
->addPoint(new LatLng(44.351172, 2.571092))
|
||||||
|
->addPoint(new LatLng(44.352097, 2.570045))
|
||||||
|
->addPoint(new LatLng(44.352665, 2.568107))
|
||||||
|
->addPoint(new LatLng(44.352887, 2.566503))
|
||||||
|
->addPoint(new LatLng(44.352806, 2.565972))
|
||||||
|
->addPoint(new LatLng(44.351517, 2.565672))
|
||||||
|
)
|
||||||
|
->getImage()
|
||||||
|
->displayPNG();
|
||||||
|
```
|
||||||
|
|
||||||
|
![Exported OpenStreetMap image](./src/samples/resources/sample1.png)
|
||||||
|
|
||||||
|
## Documentation
|
||||||
|
|
||||||
|
| Class | Description |
|
||||||
|
|--- |--- |
|
||||||
|
| [Circle](./docs/classes/DantSu/OpenStreetMapStaticAPI/Circle.md) | DantSu\OpenStreetMapStaticAPI\Circle draw circle on the map.|
|
||||||
|
| [LatLng](./docs/classes/DantSu/OpenStreetMapStaticAPI/LatLng.md) | DantSu\OpenStreetMapStaticAPI\LatLng define latitude and longitude for map, lines, markers.|
|
||||||
|
| [Line](./docs/classes/DantSu/OpenStreetMapStaticAPI/Line.md) | DantSu\OpenStreetMapStaticAPI\Line draw line on the map.|
|
||||||
|
| [MapData](./docs/classes/DantSu/OpenStreetMapStaticAPI/MapData.md) | DantSu\OpenStreetMapStaticAPI\MapData convert latitude and longitude to image pixel position.|
|
||||||
|
| [Markers](./docs/classes/DantSu/OpenStreetMapStaticAPI/Markers.md) | DantSu\OpenStreetMapStaticAPI\Markers display markers on the map.|
|
||||||
|
| [OpenStreetMap](./docs/classes/DantSu/OpenStreetMapStaticAPI/OpenStreetMap.md) | DantSu\OpenStreetMapStaticAPI\OpenStreetMap is a PHP library created for easily get static image from OpenStreetMap with markers, lines, polygons and circles.|
|
||||||
|
| [Polygon](./docs/classes/DantSu/OpenStreetMapStaticAPI/Polygon.md) | DantSu\OpenStreetMapStaticAPI\Polygon draw polygon on the map.|
|
||||||
|
| [TileLayer](./docs/classes/DantSu/OpenStreetMapStaticAPI/TileLayer.md) | DantSu\OpenStreetMapStaticAPI\TileLayer define tile server url and related configuration|
|
||||||
|
| [XY](./docs/classes/DantSu/OpenStreetMapStaticAPI/XY.md) | DantSu\OpenStreetMapStaticAPI\XY define X and Y pixel position for map, lines, markers.|
|
||||||
|
|
||||||
|
|
||||||
|
## Contributing
|
||||||
|
|
||||||
|
Please fork this repository and contribute back using pull requests.
|
||||||
|
|
||||||
|
Any contributions, large or small, major features, bug fixes, are welcomed and appreciated but will be thoroughly reviewed.
|
||||||
|
|
33
vendor/dantsu/php-osm-static-api/composer.json
vendored
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
{
|
||||||
|
"name": "dantsu/php-osm-static-api",
|
||||||
|
"type": "library",
|
||||||
|
"description": "PHP library to easily get static image from OpenStreetMap (OSM), add markers and draw lines.",
|
||||||
|
"keywords": [
|
||||||
|
"php",
|
||||||
|
"osm",
|
||||||
|
"openstreetmap",
|
||||||
|
"map",
|
||||||
|
"static",
|
||||||
|
"image",
|
||||||
|
"maps",
|
||||||
|
"api"
|
||||||
|
],
|
||||||
|
"homepage": "https://github.com/DantSu/php-osm-static-api",
|
||||||
|
"license": "MIT",
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Franck ALARY",
|
||||||
|
"homepage": "https://github.com/DantSu",
|
||||||
|
"role": "Developer"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"require": {
|
||||||
|
"php": ">=7.0",
|
||||||
|
"dantsu/php-image-editor": "^1.3"
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"DantSu\\OpenStreetMapStaticAPI\\": "src/"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
150
vendor/dantsu/php-osm-static-api/docs/classes/DantSu/OpenStreetMapStaticAPI/Circle.md
vendored
Normal file
@ -0,0 +1,150 @@
|
|||||||
|
|
||||||
|
# Circle
|
||||||
|
|
||||||
|
DantSu\OpenStreetMapStaticAPI\Circle draw circle on the map.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
* Full name: `\DantSu\OpenStreetMapStaticAPI\Circle`
|
||||||
|
* This class implements: \DantSu\OpenStreetMapStaticAPI\Interfaces\Draw
|
||||||
|
|
||||||
|
**See Also:**
|
||||||
|
|
||||||
|
* https://github.com/DantSu/php-osm-static-api - Github page of this project
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Methods
|
||||||
|
|
||||||
|
- [__construct](#-__construct)
|
||||||
|
- [setEdgePoint](#-setedgepoint)
|
||||||
|
- [setRadius](#-setradius)
|
||||||
|
- [draw](#-draw)
|
||||||
|
- [getBoundingBox](#-getboundingbox)
|
||||||
|
|
||||||
|
### ->__construct
|
||||||
|
|
||||||
|
Circle constructor.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Parameters:
|
||||||
|
|
||||||
|
| Parameter | Type | Description |
|
||||||
|
|-----------|------|-------------|
|
||||||
|
| `center` | **\DantSu\OpenStreetMapStaticAPI\LatLng** | Latitude and longitude of the circle center |
|
||||||
|
| `strokeColor` | **string** | Hexadecimal string color |
|
||||||
|
| `strokeWeight` | **int** | pixel weight of the line |
|
||||||
|
| `fillColor` | **string** | Hexadecimal string color |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
### ->setEdgePoint
|
||||||
|
|
||||||
|
Set a latitude and longitude to define the radius of the circle.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Parameters:
|
||||||
|
|
||||||
|
| Parameter | Type | Description |
|
||||||
|
|-----------|------|-------------|
|
||||||
|
| `edge` | **\DantSu\OpenStreetMapStaticAPI\LatLng** | Latitude and longitude of the edge point of a circle |
|
||||||
|
|
||||||
|
|
||||||
|
#### Return Value:
|
||||||
|
|
||||||
|
**$this** : Fluent interface
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
### ->setRadius
|
||||||
|
|
||||||
|
Set the radius of the circle in meters.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Parameters:
|
||||||
|
|
||||||
|
| Parameter | Type | Description |
|
||||||
|
|-----------|------|-------------|
|
||||||
|
| `radius` | **float** | radius of a circle in meters |
|
||||||
|
|
||||||
|
|
||||||
|
#### Return Value:
|
||||||
|
|
||||||
|
**$this** : Fluent interface
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
### ->draw
|
||||||
|
|
||||||
|
Draw the circle on the map image.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Parameters:
|
||||||
|
|
||||||
|
| Parameter | Type | Description |
|
||||||
|
|-----------|------|-------------|
|
||||||
|
| `image` | **\DantSu\PHPImageEditor\Image** | The map image (An instance of DantSu\PHPImageEditor\Image) |
|
||||||
|
| `mapData` | **\DantSu\OpenStreetMapStaticAPI\MapData** | Bounding box of the map |
|
||||||
|
|
||||||
|
|
||||||
|
#### Return Value:
|
||||||
|
|
||||||
|
**$this** : Fluent interface
|
||||||
|
|
||||||
|
|
||||||
|
#### See Also:
|
||||||
|
|
||||||
|
* https://github.com/DantSu/php-image-editor - See more about DantSu\PHPImageEditor\Image
|
||||||
|
|
||||||
|
---
|
||||||
|
### ->getBoundingBox
|
||||||
|
|
||||||
|
Get bounding box of the shape
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Return Value:
|
||||||
|
|
||||||
|
**\DantSu\OpenStreetMapStaticAPI\LatLng[]** :
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
> Automatically generated from source code comments on 2023-07-30 using [phpDocumentor](http://www.phpdoc.org/)
|
63
vendor/dantsu/php-osm-static-api/docs/classes/DantSu/OpenStreetMapStaticAPI/Interfaces/Draw.md
vendored
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
|
||||||
|
# Draw
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
* Full name: `\DantSu\OpenStreetMapStaticAPI\Interfaces\Draw`
|
||||||
|
* Parent interface: [](../../../../classes.md)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Methods
|
||||||
|
|
||||||
|
### ->getBoundingBox
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Return Value:
|
||||||
|
|
||||||
|
**array** :
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
### ->draw
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Parameters:
|
||||||
|
|
||||||
|
| Parameter | Type | Description |
|
||||||
|
|-----------|------|-------------|
|
||||||
|
| `image` | **\DantSu\PHPImageEditor\Image** | |
|
||||||
|
| `mapData` | **\DantSu\OpenStreetMapStaticAPI\MapData** | |
|
||||||
|
|
||||||
|
|
||||||
|
#### Return Value:
|
||||||
|
|
||||||
|
**mixed** :
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
> Automatically generated from source code comments on 2023-07-30 using [phpDocumentor](http://www.phpdoc.org/)
|
85
vendor/dantsu/php-osm-static-api/docs/classes/DantSu/OpenStreetMapStaticAPI/LatLng.md
vendored
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
|
||||||
|
# LatLng
|
||||||
|
|
||||||
|
DantSu\OpenStreetMapStaticAPI\LatLng define latitude and longitude for map, lines, markers.
|
||||||
|
|
||||||
|
..
|
||||||
|
|
||||||
|
* Full name: `\DantSu\OpenStreetMapStaticAPI\LatLng`
|
||||||
|
|
||||||
|
**See Also:**
|
||||||
|
|
||||||
|
* https://github.com/DantSu/php-osm-static-api - Github page of this project
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Methods
|
||||||
|
|
||||||
|
- [__construct](#-__construct)
|
||||||
|
- [getLat](#-getlat)
|
||||||
|
- [getLng](#-getlng)
|
||||||
|
|
||||||
|
### ->__construct
|
||||||
|
|
||||||
|
LatLng constructor.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Parameters:
|
||||||
|
|
||||||
|
| Parameter | Type | Description |
|
||||||
|
|-----------|------|-------------|
|
||||||
|
| `lat` | **float** | Latitude |
|
||||||
|
| `lng` | **float** | Longitude |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
### ->getLat
|
||||||
|
|
||||||
|
Get latitude
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Return Value:
|
||||||
|
|
||||||
|
**float** : Latitude
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
### ->getLng
|
||||||
|
|
||||||
|
Get longitude
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Return Value:
|
||||||
|
|
||||||
|
**float** : Longitude
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
> Automatically generated from source code comments on 2023-07-30 using [phpDocumentor](http://www.phpdoc.org/)
|
122
vendor/dantsu/php-osm-static-api/docs/classes/DantSu/OpenStreetMapStaticAPI/Line.md
vendored
Normal file
@ -0,0 +1,122 @@
|
|||||||
|
|
||||||
|
# Line
|
||||||
|
|
||||||
|
DantSu\OpenStreetMapStaticAPI\Line draw line on the map.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
* Full name: `\DantSu\OpenStreetMapStaticAPI\Line`
|
||||||
|
* This class implements: \DantSu\OpenStreetMapStaticAPI\Interfaces\Draw
|
||||||
|
|
||||||
|
**See Also:**
|
||||||
|
|
||||||
|
* https://github.com/DantSu/php-osm-static-api - Github page of this project
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Methods
|
||||||
|
|
||||||
|
- [__construct](#-__construct)
|
||||||
|
- [addPoint](#-addpoint)
|
||||||
|
- [draw](#-draw)
|
||||||
|
- [getBoundingBox](#-getboundingbox)
|
||||||
|
|
||||||
|
### ->__construct
|
||||||
|
|
||||||
|
Line constructor.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Parameters:
|
||||||
|
|
||||||
|
| Parameter | Type | Description |
|
||||||
|
|-----------|------|-------------|
|
||||||
|
| `color` | **string** | Hexadecimal string color |
|
||||||
|
| `weight` | **int** | pixel weight of the line |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
### ->addPoint
|
||||||
|
|
||||||
|
Add a latitude and longitude to the multi-points line
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Parameters:
|
||||||
|
|
||||||
|
| Parameter | Type | Description |
|
||||||
|
|-----------|------|-------------|
|
||||||
|
| `latLng` | **\DantSu\OpenStreetMapStaticAPI\LatLng** | Latitude and longitude to add |
|
||||||
|
|
||||||
|
|
||||||
|
#### Return Value:
|
||||||
|
|
||||||
|
**$this** : Fluent interface
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
### ->draw
|
||||||
|
|
||||||
|
Draw the line on the map image.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Parameters:
|
||||||
|
|
||||||
|
| Parameter | Type | Description |
|
||||||
|
|-----------|------|-------------|
|
||||||
|
| `image` | **\DantSu\PHPImageEditor\Image** | The map image (An instance of DantSu\PHPImageEditor\Image) |
|
||||||
|
| `mapData` | **\DantSu\OpenStreetMapStaticAPI\MapData** | Bounding box of the map |
|
||||||
|
|
||||||
|
|
||||||
|
#### Return Value:
|
||||||
|
|
||||||
|
**$this** : Fluent interface
|
||||||
|
|
||||||
|
|
||||||
|
#### See Also:
|
||||||
|
|
||||||
|
* https://github.com/DantSu/php-image-editor - See more about DantSu\PHPImageEditor\Image
|
||||||
|
|
||||||
|
---
|
||||||
|
### ->getBoundingBox
|
||||||
|
|
||||||
|
Get bounding box of the shape
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Return Value:
|
||||||
|
|
||||||
|
**\DantSu\OpenStreetMapStaticAPI\LatLng[]** :
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
> Automatically generated from source code comments on 2023-07-30 using [phpDocumentor](http://www.phpdoc.org/)
|
464
vendor/dantsu/php-osm-static-api/docs/classes/DantSu/OpenStreetMapStaticAPI/MapData.md
vendored
Normal file
@ -0,0 +1,464 @@
|
|||||||
|
|
||||||
|
# MapData
|
||||||
|
|
||||||
|
DantSu\OpenStreetMapStaticAPI\MapData convert latitude and longitude to image pixel position.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
* Full name: `\DantSu\OpenStreetMapStaticAPI\MapData`
|
||||||
|
|
||||||
|
**See Also:**
|
||||||
|
|
||||||
|
* https://github.com/DantSu/php-osm-static-api - Github page of this project
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Methods
|
||||||
|
|
||||||
|
- *(static)* [lngToXTile](#lngtoxtile)
|
||||||
|
- *(static)* [latToYTile](#lattoytile)
|
||||||
|
- *(static)* [xTileToLng](#xtiletolng)
|
||||||
|
- *(static)* [yTileToLat](#ytiletolat)
|
||||||
|
- *(static)* [getBoundingBoxFromPoints](#getboundingboxfrompoints)
|
||||||
|
- *(static)* [getCenterAndZoomFromBoundingBox](#getcenterandzoomfromboundingbox)
|
||||||
|
- [__construct](#-__construct)
|
||||||
|
- [getLatLngTopLeft](#-getlatlngtopleft)
|
||||||
|
- [getLatLngTopRight](#-getlatlngtopright)
|
||||||
|
- [getLatLngBottomLeft](#-getlatlngbottomleft)
|
||||||
|
- [getLatLngBottomRight](#-getlatlngbottomright)
|
||||||
|
- [getOutputSize](#-getoutputsize)
|
||||||
|
- [getZoom](#-getzoom)
|
||||||
|
- [getTileSize](#-gettilesize)
|
||||||
|
- [getTileTopLeft](#-gettiletopleft)
|
||||||
|
- [getTileBottomRight](#-gettilebottomright)
|
||||||
|
- [getMapCropTopLeft](#-getmapcroptopleft)
|
||||||
|
- [getMapCropBottomRight](#-getmapcropbottomright)
|
||||||
|
- [convertLatLngToPxPosition](#-convertlatlngtopxposition)
|
||||||
|
|
||||||
|
### ::lngToXTile
|
||||||
|
|
||||||
|
Convert longitude and zoom to horizontal OpenStreetMap tile number and pixel position.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
* This method is **static**.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Parameters:
|
||||||
|
|
||||||
|
| Parameter | Type | Description |
|
||||||
|
|-----------|------|-------------|
|
||||||
|
| `lon` | **float** | Longitude |
|
||||||
|
| `zoom` | **int** | Zoom |
|
||||||
|
| `tileSize` | **int** | Tile size |
|
||||||
|
|
||||||
|
|
||||||
|
#### Return Value:
|
||||||
|
|
||||||
|
**int[]** : OpenStreetMap tile id and pixel position of the given longitude and zoom
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
### ::latToYTile
|
||||||
|
|
||||||
|
Convert latitude and zoom to vertical OpenStreetMap tile number and pixel position.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
* This method is **static**.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Parameters:
|
||||||
|
|
||||||
|
| Parameter | Type | Description |
|
||||||
|
|-----------|------|-------------|
|
||||||
|
| `lat` | **float** | Latitude |
|
||||||
|
| `zoom` | **int** | Zoom |
|
||||||
|
| `tileSize` | **int** | Tile size |
|
||||||
|
|
||||||
|
|
||||||
|
#### Return Value:
|
||||||
|
|
||||||
|
**int[]** : OpenStreetMap tile id and pixel position of the given latitude and zoom
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
### ::xTileToLng
|
||||||
|
|
||||||
|
Convert horizontal OpenStreetMap tile number ad zoom to longitude.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
* This method is **static**.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Parameters:
|
||||||
|
|
||||||
|
| Parameter | Type | Description |
|
||||||
|
|-----------|------|-------------|
|
||||||
|
| `id` | **int** | Horizontal OpenStreetMap tile id |
|
||||||
|
| `position` | **int** | Horizontal pixel position on tile |
|
||||||
|
| `zoom` | **int** | Zoom |
|
||||||
|
| `tileSize` | **int** | Tile size |
|
||||||
|
|
||||||
|
|
||||||
|
#### Return Value:
|
||||||
|
|
||||||
|
**float** : Longitude of the given OpenStreetMap tile id and zoom
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
### ::yTileToLat
|
||||||
|
|
||||||
|
Convert vertical OpenStreetMap tile number and zoom to latitude.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
* This method is **static**.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Parameters:
|
||||||
|
|
||||||
|
| Parameter | Type | Description |
|
||||||
|
|-----------|------|-------------|
|
||||||
|
| `id` | **int** | Vertical OpenStreetMap tile id |
|
||||||
|
| `position` | **int** | Vertical pixel position on tile |
|
||||||
|
| `zoom` | **int** | Zoom |
|
||||||
|
| `tileSize` | **int** | Tile size |
|
||||||
|
|
||||||
|
|
||||||
|
#### Return Value:
|
||||||
|
|
||||||
|
**float** : Latitude of the given OpenStreetMap tile id and zoom
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
### ::getBoundingBoxFromPoints
|
||||||
|
|
||||||
|
Transform array of LatLng to bounding box
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
* This method is **static**.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Parameters:
|
||||||
|
|
||||||
|
| Parameter | Type | Description |
|
||||||
|
|-----------|------|-------------|
|
||||||
|
| `points` | **\DantSu\OpenStreetMapStaticAPI\LatLng[]** | |
|
||||||
|
|
||||||
|
|
||||||
|
#### Return Value:
|
||||||
|
|
||||||
|
**\DantSu\OpenStreetMapStaticAPI\LatLng[]** :
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
### ::getCenterAndZoomFromBoundingBox
|
||||||
|
|
||||||
|
Get center and zoom from two points.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
* This method is **static**.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Parameters:
|
||||||
|
|
||||||
|
| Parameter | Type | Description |
|
||||||
|
|-----------|------|-------------|
|
||||||
|
| `topLeft` | **\DantSu\OpenStreetMapStaticAPI\LatLng** | |
|
||||||
|
| `bottomRight` | **\DantSu\OpenStreetMapStaticAPI\LatLng** | |
|
||||||
|
| `padding` | **int** | |
|
||||||
|
| `imageWidth` | **int** | |
|
||||||
|
| `imageHeight` | **int** | |
|
||||||
|
| `tileSize` | **int** | |
|
||||||
|
|
||||||
|
|
||||||
|
#### Return Value:
|
||||||
|
|
||||||
|
**array** : center : LatLng, zoom : int
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
### ->__construct
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Parameters:
|
||||||
|
|
||||||
|
| Parameter | Type | Description |
|
||||||
|
|-----------|------|-------------|
|
||||||
|
| `centerMap` | **\DantSu\OpenStreetMapStaticAPI\LatLng** | |
|
||||||
|
| `zoom` | **int** | |
|
||||||
|
| `outputSize` | **\DantSu\OpenStreetMapStaticAPI\XY** | |
|
||||||
|
| `tileSize` | **int** | |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
### ->getLatLngTopLeft
|
||||||
|
|
||||||
|
Get latitude and longitude of top left image
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Return Value:
|
||||||
|
|
||||||
|
**\DantSu\OpenStreetMapStaticAPI\LatLng** : Latitude and longitude of top left image
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
### ->getLatLngTopRight
|
||||||
|
|
||||||
|
Get latitude and longitude of top right image
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Return Value:
|
||||||
|
|
||||||
|
**\DantSu\OpenStreetMapStaticAPI\LatLng** : Latitude and longitude of top right image
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
### ->getLatLngBottomLeft
|
||||||
|
|
||||||
|
Get latitude and longitude of bottom left image
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Return Value:
|
||||||
|
|
||||||
|
**\DantSu\OpenStreetMapStaticAPI\LatLng** : Latitude and longitude of bottom left image
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
### ->getLatLngBottomRight
|
||||||
|
|
||||||
|
Get latitude and longitude of bottom right image
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Return Value:
|
||||||
|
|
||||||
|
**\DantSu\OpenStreetMapStaticAPI\LatLng** : Latitude and longitude of bottom right image
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
### ->getOutputSize
|
||||||
|
|
||||||
|
Get width and height of the image in pixel
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Return Value:
|
||||||
|
|
||||||
|
**\DantSu\OpenStreetMapStaticAPI\XY** : Width and height of the image in pixel
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
### ->getZoom
|
||||||
|
|
||||||
|
Get the zoom
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Return Value:
|
||||||
|
|
||||||
|
**int** : zoom
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
### ->getTileSize
|
||||||
|
|
||||||
|
Get tile size
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Return Value:
|
||||||
|
|
||||||
|
**int** : tile size
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
### ->getTileTopLeft
|
||||||
|
|
||||||
|
Get top left tile numbers
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Return Value:
|
||||||
|
|
||||||
|
**\DantSu\OpenStreetMapStaticAPI\XY** : top left tile numbers
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
### ->getTileBottomRight
|
||||||
|
|
||||||
|
Get bottom right tile numbers
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Return Value:
|
||||||
|
|
||||||
|
**\DantSu\OpenStreetMapStaticAPI\XY** : bottom right tile numbers
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
### ->getMapCropTopLeft
|
||||||
|
|
||||||
|
Get top left crop pixels
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Return Value:
|
||||||
|
|
||||||
|
**\DantSu\OpenStreetMapStaticAPI\XY** : top left crop pixels
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
### ->getMapCropBottomRight
|
||||||
|
|
||||||
|
Get bottom right crop pixels
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Return Value:
|
||||||
|
|
||||||
|
**\DantSu\OpenStreetMapStaticAPI\XY** : bottom right crop pixels
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
### ->convertLatLngToPxPosition
|
||||||
|
|
||||||
|
Convert a latitude and longitude to a XY pixel position in the image
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Parameters:
|
||||||
|
|
||||||
|
| Parameter | Type | Description |
|
||||||
|
|-----------|------|-------------|
|
||||||
|
| `latLng` | **\DantSu\OpenStreetMapStaticAPI\LatLng** | Latitude and longitude to be converted |
|
||||||
|
|
||||||
|
|
||||||
|
#### Return Value:
|
||||||
|
|
||||||
|
**\DantSu\OpenStreetMapStaticAPI\XY** : Pixel position of latitude and longitude in the image
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
> Automatically generated from source code comments on 2023-07-30 using [phpDocumentor](http://www.phpdoc.org/)
|
158
vendor/dantsu/php-osm-static-api/docs/classes/DantSu/OpenStreetMapStaticAPI/Markers.md
vendored
Normal file
@ -0,0 +1,158 @@
|
|||||||
|
|
||||||
|
# Markers
|
||||||
|
|
||||||
|
DantSu\OpenStreetMapStaticAPI\Markers display markers on the map.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
* Full name: `\DantSu\OpenStreetMapStaticAPI\Markers`
|
||||||
|
|
||||||
|
**See Also:**
|
||||||
|
|
||||||
|
* https://github.com/DantSu/php-osm-static-api - Github page of this project
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Constants
|
||||||
|
|
||||||
|
| Constant | Value |
|
||||||
|
|:--- |:--- |
|
||||||
|
|`\DantSu\OpenStreetMapStaticAPI\Markers::ANCHOR_LEFT`|'left'|
|
||||||
|
|`\DantSu\OpenStreetMapStaticAPI\Markers::ANCHOR_CENTER`|'center'|
|
||||||
|
|`\DantSu\OpenStreetMapStaticAPI\Markers::ANCHOR_RIGHT`|'right'|
|
||||||
|
|`\DantSu\OpenStreetMapStaticAPI\Markers::ANCHOR_TOP`|'top'|
|
||||||
|
|`\DantSu\OpenStreetMapStaticAPI\Markers::ANCHOR_MIDDLE`|'middle'|
|
||||||
|
|`\DantSu\OpenStreetMapStaticAPI\Markers::ANCHOR_BOTTOM`|'bottom'|
|
||||||
|
|
||||||
|
## Methods
|
||||||
|
|
||||||
|
- [__construct](#-__construct)
|
||||||
|
- [addMarker](#-addmarker)
|
||||||
|
- [setAnchor](#-setanchor)
|
||||||
|
- [draw](#-draw)
|
||||||
|
- [getBoundingBox](#-getboundingbox)
|
||||||
|
|
||||||
|
### ->__construct
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Parameters:
|
||||||
|
|
||||||
|
| Parameter | Type | Description |
|
||||||
|
|-----------|------|-------------|
|
||||||
|
| `pathImage` | **mixed** | |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
### ->addMarker
|
||||||
|
|
||||||
|
Add a marker on the map.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Parameters:
|
||||||
|
|
||||||
|
| Parameter | Type | Description |
|
||||||
|
|-----------|------|-------------|
|
||||||
|
| `coordinate` | **\DantSu\OpenStreetMapStaticAPI\LatLng** | Latitude and longitude of the marker |
|
||||||
|
|
||||||
|
|
||||||
|
#### Return Value:
|
||||||
|
|
||||||
|
**$this** : Fluent interface
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
### ->setAnchor
|
||||||
|
|
||||||
|
Define the anchor point of the image marker.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Parameters:
|
||||||
|
|
||||||
|
| Parameter | Type | Description |
|
||||||
|
|-----------|------|-------------|
|
||||||
|
| `horizontalAnchor` | **int|string** | Horizontal anchor in pixel or you can use `Markers::ANCHOR_LEFT`, `Markers::ANCHOR_CENTER`, `Markers::ANCHOR_RIGHT` |
|
||||||
|
| `verticalAnchor` | **int|string** | Vertical anchor in pixel or you can use `Markers::ANCHOR_TOP`, `Markers::ANCHOR_MIDDLE`, `Markers::ANCHOR_BOTTOM` |
|
||||||
|
|
||||||
|
|
||||||
|
#### Return Value:
|
||||||
|
|
||||||
|
**$this** : Fluent interface
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
### ->draw
|
||||||
|
|
||||||
|
Draw markers on the image map.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Parameters:
|
||||||
|
|
||||||
|
| Parameter | Type | Description |
|
||||||
|
|-----------|------|-------------|
|
||||||
|
| `image` | **\DantSu\PHPImageEditor\Image** | The map image (An instance of DantSu\PHPImageEditor\Image) |
|
||||||
|
| `mapData` | **\DantSu\OpenStreetMapStaticAPI\MapData** | Bounding box of the map |
|
||||||
|
|
||||||
|
|
||||||
|
#### Return Value:
|
||||||
|
|
||||||
|
**$this** : Fluent interface
|
||||||
|
|
||||||
|
|
||||||
|
#### See Also:
|
||||||
|
|
||||||
|
* https://github.com/DantSu/php-image-editor - See more about DantSu\PHPImageEditor\Image
|
||||||
|
|
||||||
|
---
|
||||||
|
### ->getBoundingBox
|
||||||
|
|
||||||
|
Get bounding box of markers
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Return Value:
|
||||||
|
|
||||||
|
**\DantSu\OpenStreetMapStaticAPI\LatLng[]** :
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
> Automatically generated from source code comments on 2023-07-30 using [phpDocumentor](http://www.phpdoc.org/)
|
341
vendor/dantsu/php-osm-static-api/docs/classes/DantSu/OpenStreetMapStaticAPI/OpenStreetMap.md
vendored
Normal file
@ -0,0 +1,341 @@
|
|||||||
|
|
||||||
|
# OpenStreetMap
|
||||||
|
|
||||||
|
DantSu\OpenStreetMapStaticAPI\OpenStreetMap is a PHP library created for easily get static image from OpenStreetMap with markers, lines, polygons and circles.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
* Full name: `\DantSu\OpenStreetMapStaticAPI\OpenStreetMap`
|
||||||
|
|
||||||
|
**See Also:**
|
||||||
|
|
||||||
|
* https://github.com/DantSu/php-osm-static-api - Github page of this project
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Methods
|
||||||
|
|
||||||
|
- *(static)* [createFromLatLngZoom](#createfromlatlngzoom)
|
||||||
|
- *(static)* [createFromBoundingBox](#createfromboundingbox)
|
||||||
|
- [__construct](#-__construct)
|
||||||
|
- [addLayer](#-addlayer)
|
||||||
|
- [addMarkers](#-addmarkers)
|
||||||
|
- [addDraw](#-adddraw)
|
||||||
|
- [fitToDraws](#-fittodraws)
|
||||||
|
- [fitToMarkers](#-fittomarkers)
|
||||||
|
- [fitToMarkersAndDraws](#-fittomarkersanddraws)
|
||||||
|
- [fitToPoints](#-fittopoints)
|
||||||
|
- [getMapData](#-getmapdata)
|
||||||
|
- [getImage](#-getimage)
|
||||||
|
|
||||||
|
### ::createFromLatLngZoom
|
||||||
|
|
||||||
|
Create new instance of OpenStreetMap.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
* This method is **static**.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Parameters:
|
||||||
|
|
||||||
|
| Parameter | Type | Description |
|
||||||
|
|-----------|------|-------------|
|
||||||
|
| `centerMap` | **\DantSu\OpenStreetMapStaticAPI\LatLng** | Latitude and longitude of the map center |
|
||||||
|
| `zoom` | **int** | Zoom |
|
||||||
|
| `imageWidth` | **int** | Width of the generated map image |
|
||||||
|
| `imageHeight` | **int** | Height of the generated map image |
|
||||||
|
| `tileLayer` | **\DantSu\OpenStreetMapStaticAPI\TileLayer** | Tile server configuration, defaults to OpenStreetMaps tile server |
|
||||||
|
| `tileSize` | **int** | Tile size in pixels |
|
||||||
|
|
||||||
|
|
||||||
|
#### Return Value:
|
||||||
|
|
||||||
|
**\DantSu\OpenStreetMapStaticAPI\OpenStreetMap** :
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
### ::createFromBoundingBox
|
||||||
|
|
||||||
|
Create new instance of OpenStreetMap.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
* This method is **static**.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Parameters:
|
||||||
|
|
||||||
|
| Parameter | Type | Description |
|
||||||
|
|-----------|------|-------------|
|
||||||
|
| `topLeft` | **\DantSu\OpenStreetMapStaticAPI\LatLng** | Latitude and longitude of the map top left |
|
||||||
|
| `bottomRight` | **\DantSu\OpenStreetMapStaticAPI\LatLng** | Latitude and longitude of the map bottom right |
|
||||||
|
| `padding` | **int** | Padding to add before top left and after bottom right position. |
|
||||||
|
| `imageWidth` | **int** | Width of the generated map image |
|
||||||
|
| `imageHeight` | **int** | Height of the generated map image |
|
||||||
|
| `tileLayer` | **\DantSu\OpenStreetMapStaticAPI\TileLayer** | Tile server configuration, defaults to OpenStreetMaps tile server |
|
||||||
|
| `tileSize` | **int** | Tile size in pixels |
|
||||||
|
|
||||||
|
|
||||||
|
#### Return Value:
|
||||||
|
|
||||||
|
**\DantSu\OpenStreetMapStaticAPI\OpenStreetMap** :
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
### ->__construct
|
||||||
|
|
||||||
|
OpenStreetMap constructor.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Parameters:
|
||||||
|
|
||||||
|
| Parameter | Type | Description |
|
||||||
|
|-----------|------|-------------|
|
||||||
|
| `centerMap` | **\DantSu\OpenStreetMapStaticAPI\LatLng** | Latitude and longitude of the map center |
|
||||||
|
| `zoom` | **int** | Zoom |
|
||||||
|
| `imageWidth` | **int** | Width of the generated map image |
|
||||||
|
| `imageHeight` | **int** | Height of the generated map image |
|
||||||
|
| `tileLayer` | **\DantSu\OpenStreetMapStaticAPI\TileLayer** | Tile server configuration, defaults to OpenStreetMaps tile server |
|
||||||
|
| `tileSize` | **int** | Tile size in pixels |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
### ->addLayer
|
||||||
|
|
||||||
|
Add tile layer to the map
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Parameters:
|
||||||
|
|
||||||
|
| Parameter | Type | Description |
|
||||||
|
|-----------|------|-------------|
|
||||||
|
| `layer` | **\DantSu\OpenStreetMapStaticAPI\TileLayer** | An instance of TileLayer |
|
||||||
|
|
||||||
|
|
||||||
|
#### Return Value:
|
||||||
|
|
||||||
|
**$this** : Fluent interface
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
### ->addMarkers
|
||||||
|
|
||||||
|
Add markers on the map
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Parameters:
|
||||||
|
|
||||||
|
| Parameter | Type | Description |
|
||||||
|
|-----------|------|-------------|
|
||||||
|
| `markers` | **\DantSu\OpenStreetMapStaticAPI\Markers** | An instance of Markers |
|
||||||
|
|
||||||
|
|
||||||
|
#### Return Value:
|
||||||
|
|
||||||
|
**$this** : Fluent interface
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
### ->addDraw
|
||||||
|
|
||||||
|
Add a line on the map
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Parameters:
|
||||||
|
|
||||||
|
| Parameter | Type | Description |
|
||||||
|
|-----------|------|-------------|
|
||||||
|
| `draw` | **\DantSu\OpenStreetMapStaticAPI\Interfaces\Draw** | An instance of Line |
|
||||||
|
|
||||||
|
|
||||||
|
#### Return Value:
|
||||||
|
|
||||||
|
**$this** : Fluent interface
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
### ->fitToDraws
|
||||||
|
|
||||||
|
Fit map to draws.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Parameters:
|
||||||
|
|
||||||
|
| Parameter | Type | Description |
|
||||||
|
|-----------|------|-------------|
|
||||||
|
| `padding` | **int** | Padding in pixel |
|
||||||
|
|
||||||
|
|
||||||
|
#### Return Value:
|
||||||
|
|
||||||
|
**$this** : Fluent interface
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
### ->fitToMarkers
|
||||||
|
|
||||||
|
Fit map to markers.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Parameters:
|
||||||
|
|
||||||
|
| Parameter | Type | Description |
|
||||||
|
|-----------|------|-------------|
|
||||||
|
| `padding` | **int** | Padding in pixel |
|
||||||
|
|
||||||
|
|
||||||
|
#### Return Value:
|
||||||
|
|
||||||
|
**$this** : Fluent interface
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
### ->fitToMarkersAndDraws
|
||||||
|
|
||||||
|
Fit map to draws and markers.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Parameters:
|
||||||
|
|
||||||
|
| Parameter | Type | Description |
|
||||||
|
|-----------|------|-------------|
|
||||||
|
| `padding` | **int** | Padding in pixel |
|
||||||
|
|
||||||
|
|
||||||
|
#### Return Value:
|
||||||
|
|
||||||
|
**$this** : Fluent interface
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
### ->fitToPoints
|
||||||
|
|
||||||
|
Fit map to an array of points.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Parameters:
|
||||||
|
|
||||||
|
| Parameter | Type | Description |
|
||||||
|
|-----------|------|-------------|
|
||||||
|
| `points` | **\DantSu\OpenStreetMapStaticAPI\LatLng[]** | LatLng points |
|
||||||
|
| `padding` | **int** | Padding in pixel |
|
||||||
|
|
||||||
|
|
||||||
|
#### Return Value:
|
||||||
|
|
||||||
|
**$this** : Fluent interface
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
### ->getMapData
|
||||||
|
|
||||||
|
Get data about the generated map (bounding box, size, OSM tile ids...)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Return Value:
|
||||||
|
|
||||||
|
**\DantSu\OpenStreetMapStaticAPI\MapData** : data about the generated map (bounding box, size, OSM tile ids...)
|
||||||
|
|
||||||
|
|
||||||
|
#### See Also:
|
||||||
|
|
||||||
|
* https://github.com/DantSu/php-osm-static-api/blob/master/docs/classes/DantSu/OpenStreetMapStaticAPI/MapData.md - See more about MapData
|
||||||
|
|
||||||
|
---
|
||||||
|
### ->getImage
|
||||||
|
|
||||||
|
Get the map image with markers and lines.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Return Value:
|
||||||
|
|
||||||
|
**\DantSu\PHPImageEditor\Image** : An instance of DantSu\PHPImageEditor\Image
|
||||||
|
|
||||||
|
|
||||||
|
#### See Also:
|
||||||
|
|
||||||
|
* https://github.com/DantSu/php-image-editor - See more about DantSu\PHPImageEditor\Image
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
> Automatically generated from source code comments on 2023-07-30 using [phpDocumentor](http://www.phpdoc.org/)
|
123
vendor/dantsu/php-osm-static-api/docs/classes/DantSu/OpenStreetMapStaticAPI/Polygon.md
vendored
Normal file
@ -0,0 +1,123 @@
|
|||||||
|
|
||||||
|
# Polygon
|
||||||
|
|
||||||
|
DantSu\OpenStreetMapStaticAPI\Polygon draw polygon on the map.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
* Full name: `\DantSu\OpenStreetMapStaticAPI\Polygon`
|
||||||
|
* This class implements: \DantSu\OpenStreetMapStaticAPI\Interfaces\Draw
|
||||||
|
|
||||||
|
**See Also:**
|
||||||
|
|
||||||
|
* https://github.com/DantSu/php-osm-static-api - Github page of this project
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Methods
|
||||||
|
|
||||||
|
- [__construct](#-__construct)
|
||||||
|
- [addPoint](#-addpoint)
|
||||||
|
- [draw](#-draw)
|
||||||
|
- [getBoundingBox](#-getboundingbox)
|
||||||
|
|
||||||
|
### ->__construct
|
||||||
|
|
||||||
|
Polygon constructor.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Parameters:
|
||||||
|
|
||||||
|
| Parameter | Type | Description |
|
||||||
|
|-----------|------|-------------|
|
||||||
|
| `strokeColor` | **string** | Hexadecimal string color |
|
||||||
|
| `strokeWeight` | **int** | pixel weight of the line |
|
||||||
|
| `fillColor` | **string** | Hexadecimal string color |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
### ->addPoint
|
||||||
|
|
||||||
|
Add a latitude and longitude to the polygon
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Parameters:
|
||||||
|
|
||||||
|
| Parameter | Type | Description |
|
||||||
|
|-----------|------|-------------|
|
||||||
|
| `latLng` | **\DantSu\OpenStreetMapStaticAPI\LatLng** | Latitude and longitude to add |
|
||||||
|
|
||||||
|
|
||||||
|
#### Return Value:
|
||||||
|
|
||||||
|
**$this** : Fluent interface
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
### ->draw
|
||||||
|
|
||||||
|
Draw the polygon on the map image.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Parameters:
|
||||||
|
|
||||||
|
| Parameter | Type | Description |
|
||||||
|
|-----------|------|-------------|
|
||||||
|
| `image` | **\DantSu\PHPImageEditor\Image** | The map image (An instance of DantSu\PHPImageEditor\Image) |
|
||||||
|
| `mapData` | **\DantSu\OpenStreetMapStaticAPI\MapData** | Bounding box of the map |
|
||||||
|
|
||||||
|
|
||||||
|
#### Return Value:
|
||||||
|
|
||||||
|
**$this** : Fluent interface
|
||||||
|
|
||||||
|
|
||||||
|
#### See Also:
|
||||||
|
|
||||||
|
* https://github.com/DantSu/php-image-editor - See more about DantSu\PHPImageEditor\Image
|
||||||
|
|
||||||
|
---
|
||||||
|
### ->getBoundingBox
|
||||||
|
|
||||||
|
Get bounding box of the shape
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Return Value:
|
||||||
|
|
||||||
|
**\DantSu\OpenStreetMapStaticAPI\LatLng[]** :
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
> Automatically generated from source code comments on 2023-07-30 using [phpDocumentor](http://www.phpdoc.org/)
|
289
vendor/dantsu/php-osm-static-api/docs/classes/DantSu/OpenStreetMapStaticAPI/TileLayer.md
vendored
Normal file
@ -0,0 +1,289 @@
|
|||||||
|
|
||||||
|
# TileLayer
|
||||||
|
|
||||||
|
DantSu\OpenStreetMapStaticAPI\TileLayer define tile server url and related configuration
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
* Full name: `\DantSu\OpenStreetMapStaticAPI\TileLayer`
|
||||||
|
|
||||||
|
**See Also:**
|
||||||
|
|
||||||
|
* https://github.com/DantSu/php-osm-static-api - Github page of this project
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Methods
|
||||||
|
|
||||||
|
- *(static)* [defaultTileLayer](#defaulttilelayer)
|
||||||
|
- [__construct](#-__construct)
|
||||||
|
- [setOpacity](#-setopacity)
|
||||||
|
- [setMaxZoom](#-setmaxzoom)
|
||||||
|
- [getMaxZoom](#-getmaxzoom)
|
||||||
|
- [setMinZoom](#-setminzoom)
|
||||||
|
- [getMinZoom](#-getminzoom)
|
||||||
|
- [checkZoom](#-checkzoom)
|
||||||
|
- [getTileUrl](#-gettileurl)
|
||||||
|
- [getAttributionText](#-getattributiontext)
|
||||||
|
- [getTile](#-gettile)
|
||||||
|
|
||||||
|
### ::defaultTileLayer
|
||||||
|
|
||||||
|
Default tile server. OpenStreetMaps with related attribution text
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
* This method is **static**.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Return Value:
|
||||||
|
|
||||||
|
**\DantSu\OpenStreetMapStaticAPI\TileLayer** : default tile server
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
### ->__construct
|
||||||
|
|
||||||
|
TileLayer constructor
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Parameters:
|
||||||
|
|
||||||
|
| Parameter | Type | Description |
|
||||||
|
|-----------|------|-------------|
|
||||||
|
| `url` | **string** | tile server url with placeholders (`x`, `y`, `z`, `r`, `s`) |
|
||||||
|
| `attributionText` | **string** | tile server attribution text |
|
||||||
|
| `subdomains` | **string** | tile server subdomains |
|
||||||
|
| `curlOptions` | **array** | Array of curl options |
|
||||||
|
| `failCurlOnError` | **bool** | If true, curl will throw an exception on error. |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
### ->setOpacity
|
||||||
|
|
||||||
|
Set opacity of the layer
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Parameters:
|
||||||
|
|
||||||
|
| Parameter | Type | Description |
|
||||||
|
|-----------|------|-------------|
|
||||||
|
| `opacity` | **float** | Opacity value (0 to 1) |
|
||||||
|
|
||||||
|
|
||||||
|
#### Return Value:
|
||||||
|
|
||||||
|
**$this** : Fluent interface
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
### ->setMaxZoom
|
||||||
|
|
||||||
|
Set a max zoom value
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Parameters:
|
||||||
|
|
||||||
|
| Parameter | Type | Description |
|
||||||
|
|-----------|------|-------------|
|
||||||
|
| `maxZoom` | **int** | |
|
||||||
|
|
||||||
|
|
||||||
|
#### Return Value:
|
||||||
|
|
||||||
|
**$this** : Fluent interface
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
### ->getMaxZoom
|
||||||
|
|
||||||
|
Get max zoom value
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Return Value:
|
||||||
|
|
||||||
|
**int** :
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
### ->setMinZoom
|
||||||
|
|
||||||
|
Set a min zoom value
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Parameters:
|
||||||
|
|
||||||
|
| Parameter | Type | Description |
|
||||||
|
|-----------|------|-------------|
|
||||||
|
| `minZoom` | **int** | |
|
||||||
|
|
||||||
|
|
||||||
|
#### Return Value:
|
||||||
|
|
||||||
|
**$this** : Fluent interface
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
### ->getMinZoom
|
||||||
|
|
||||||
|
Get min zoom value
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Return Value:
|
||||||
|
|
||||||
|
**int** :
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
### ->checkZoom
|
||||||
|
|
||||||
|
Check if zoom value is between min zoom and max zoom
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Parameters:
|
||||||
|
|
||||||
|
| Parameter | Type | Description |
|
||||||
|
|-----------|------|-------------|
|
||||||
|
| `zoom` | **int** | Zoom value to be checked |
|
||||||
|
|
||||||
|
|
||||||
|
#### Return Value:
|
||||||
|
|
||||||
|
**int** :
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
### ->getTileUrl
|
||||||
|
|
||||||
|
Get tile url for coordinates and zoom level
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Parameters:
|
||||||
|
|
||||||
|
| Parameter | Type | Description |
|
||||||
|
|-----------|------|-------------|
|
||||||
|
| `x` | **int** | x coordinate |
|
||||||
|
| `y` | **int** | y coordinate |
|
||||||
|
| `z` | **int** | zoom level |
|
||||||
|
|
||||||
|
|
||||||
|
#### Return Value:
|
||||||
|
|
||||||
|
**string** : tile url
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
### ->getAttributionText
|
||||||
|
|
||||||
|
Get attribution text
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Return Value:
|
||||||
|
|
||||||
|
**string** : Attribution text
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
### ->getTile
|
||||||
|
|
||||||
|
Get an image tile
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Parameters:
|
||||||
|
|
||||||
|
| Parameter | Type | Description |
|
||||||
|
|-----------|------|-------------|
|
||||||
|
| `x` | **float** | |
|
||||||
|
| `y` | **float** | |
|
||||||
|
| `z` | **int** | |
|
||||||
|
| `tileSize` | **int** | |
|
||||||
|
|
||||||
|
|
||||||
|
#### Return Value:
|
||||||
|
|
||||||
|
**\DantSu\PHPImageEditor\Image** : Image instance containing the tile
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
> Automatically generated from source code comments on 2023-07-30 using [phpDocumentor](http://www.phpdoc.org/)
|
@ -0,0 +1,127 @@
|
|||||||
|
|
||||||
|
# GeographicConverter
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
* Full name: `\DantSu\OpenStreetMapStaticAPI\Utils\GeographicConverter`
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Methods
|
||||||
|
|
||||||
|
- *(static)* [earthRadiusAtLatitude](#earthradiusatlatitude)
|
||||||
|
- *(static)* [metersToLatLng](#meterstolatlng)
|
||||||
|
- *(static)* [latLngToMeters](#latlngtometers)
|
||||||
|
- *(static)* [getCenter](#getcenter)
|
||||||
|
|
||||||
|
### ::earthRadiusAtLatitude
|
||||||
|
|
||||||
|
Calculate the earth radius at the given latitude
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
* This method is **static**.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Parameters:
|
||||||
|
|
||||||
|
| Parameter | Type | Description |
|
||||||
|
|-----------|------|-------------|
|
||||||
|
| `lat` | **float** | |
|
||||||
|
|
||||||
|
|
||||||
|
#### Return Value:
|
||||||
|
|
||||||
|
**float** :
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
### ::metersToLatLng
|
||||||
|
|
||||||
|
Convert distance and angle from a point to latitude and longitude
|
||||||
|
0 : top, 90 : right; 180 : bottom, 270 : left
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
* This method is **static**.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Parameters:
|
||||||
|
|
||||||
|
| Parameter | Type | Description |
|
||||||
|
|-----------|------|-------------|
|
||||||
|
| `from` | **\DantSu\OpenStreetMapStaticAPI\LatLng** | Starting coordinate |
|
||||||
|
| `distance` | **float** | Distance in meters |
|
||||||
|
| `angle` | **float** | Angle in degrees |
|
||||||
|
|
||||||
|
|
||||||
|
#### Return Value:
|
||||||
|
|
||||||
|
**\DantSu\OpenStreetMapStaticAPI\LatLng** :
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
### ::latLngToMeters
|
||||||
|
|
||||||
|
Get distance in meters between two points.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
* This method is **static**.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Parameters:
|
||||||
|
|
||||||
|
| Parameter | Type | Description |
|
||||||
|
|-----------|------|-------------|
|
||||||
|
| `from` | **\DantSu\OpenStreetMapStaticAPI\LatLng** | Starting coordinate |
|
||||||
|
| `end` | **\DantSu\OpenStreetMapStaticAPI\LatLng** | Ending coordinate |
|
||||||
|
|
||||||
|
|
||||||
|
#### Return Value:
|
||||||
|
|
||||||
|
**float** :
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
### ::getCenter
|
||||||
|
|
||||||
|
Get center between two coordinates.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
* This method is **static**.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Parameters:
|
||||||
|
|
||||||
|
| Parameter | Type | Description |
|
||||||
|
|-----------|------|-------------|
|
||||||
|
| `point1` | **\DantSu\OpenStreetMapStaticAPI\LatLng** | Vertical OpenStreetMap tile id |
|
||||||
|
| `point2` | **\DantSu\OpenStreetMapStaticAPI\LatLng** | Vertical pixel position on tile |
|
||||||
|
|
||||||
|
|
||||||
|
#### Return Value:
|
||||||
|
|
||||||
|
**\DantSu\OpenStreetMapStaticAPI\LatLng** : midpoint between the given coordinates
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
> Automatically generated from source code comments on 2023-07-30 using [phpDocumentor](http://www.phpdoc.org/)
|
85
vendor/dantsu/php-osm-static-api/docs/classes/DantSu/OpenStreetMapStaticAPI/XY.md
vendored
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
|
||||||
|
# XY
|
||||||
|
|
||||||
|
DantSu\OpenStreetMapStaticAPI\XY define X and Y pixel position for map, lines, markers.
|
||||||
|
|
||||||
|
..
|
||||||
|
|
||||||
|
* Full name: `\DantSu\OpenStreetMapStaticAPI\XY`
|
||||||
|
|
||||||
|
**See Also:**
|
||||||
|
|
||||||
|
* https://github.com/DantSu/php-osm-static-api - Github page of this project
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Methods
|
||||||
|
|
||||||
|
- [__construct](#-__construct)
|
||||||
|
- [getX](#-getx)
|
||||||
|
- [getY](#-gety)
|
||||||
|
|
||||||
|
### ->__construct
|
||||||
|
|
||||||
|
XY constructor.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Parameters:
|
||||||
|
|
||||||
|
| Parameter | Type | Description |
|
||||||
|
|-----------|------|-------------|
|
||||||
|
| `x` | **int** | X |
|
||||||
|
| `y` | **int** | Y |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
### ->getX
|
||||||
|
|
||||||
|
Get X
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Return Value:
|
||||||
|
|
||||||
|
**int** : X
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
### ->getY
|
||||||
|
|
||||||
|
Get Y
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Return Value:
|
||||||
|
|
||||||
|
**int** : Y
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
> Automatically generated from source code comments on 2023-07-30 using [phpDocumentor](http://www.phpdoc.org/)
|
54
vendor/dantsu/php-osm-static-api/docs/index.md
vendored
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
|
||||||
|
# PHP OpenStreetMap Static API
|
||||||
|
|
||||||
|
This is an automatically generated documentation for **PHP OpenStreetMap Static API**.
|
||||||
|
|
||||||
|
|
||||||
|
## Namespaces
|
||||||
|
|
||||||
|
|
||||||
|
### \DantSu\OpenStreetMapStaticAPI
|
||||||
|
|
||||||
|
#### Classes
|
||||||
|
|
||||||
|
| Class | Description |
|
||||||
|
|--- |--- |
|
||||||
|
| [Circle](./classes/DantSu/OpenStreetMapStaticAPI/Circle.md) | DantSu\OpenStreetMapStaticAPI\Circle draw circle on the map.|
|
||||||
|
| [LatLng](./classes/DantSu/OpenStreetMapStaticAPI/LatLng.md) | DantSu\OpenStreetMapStaticAPI\LatLng define latitude and longitude for map, lines, markers.|
|
||||||
|
| [Line](./classes/DantSu/OpenStreetMapStaticAPI/Line.md) | DantSu\OpenStreetMapStaticAPI\Line draw line on the map.|
|
||||||
|
| [MapData](./classes/DantSu/OpenStreetMapStaticAPI/MapData.md) | DantSu\OpenStreetMapStaticAPI\MapData convert latitude and longitude to image pixel position.|
|
||||||
|
| [Markers](./classes/DantSu/OpenStreetMapStaticAPI/Markers.md) | DantSu\OpenStreetMapStaticAPI\Markers display markers on the map.|
|
||||||
|
| [OpenStreetMap](./classes/DantSu/OpenStreetMapStaticAPI/OpenStreetMap.md) | DantSu\OpenStreetMapStaticAPI\OpenStreetMap is a PHP library created for easily get static image from OpenStreetMap with markers, lines, polygons and circles.|
|
||||||
|
| [Polygon](./classes/DantSu/OpenStreetMapStaticAPI/Polygon.md) | DantSu\OpenStreetMapStaticAPI\Polygon draw polygon on the map.|
|
||||||
|
| [TileLayer](./classes/DantSu/OpenStreetMapStaticAPI/TileLayer.md) | DantSu\OpenStreetMapStaticAPI\TileLayer define tile server url and related configuration|
|
||||||
|
| [XY](./classes/DantSu/OpenStreetMapStaticAPI/XY.md) | DantSu\OpenStreetMapStaticAPI\XY define X and Y pixel position for map, lines, markers.|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### \DantSu\OpenStreetMapStaticAPI\Interfaces
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Interfaces
|
||||||
|
|
||||||
|
| Interface | Description |
|
||||||
|
|--- |--- |
|
||||||
|
| [Draw](./classes/DantSu/OpenStreetMapStaticAPI/Interfaces/Draw.md) | |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### \DantSu\OpenStreetMapStaticAPI\Utils
|
||||||
|
|
||||||
|
#### Classes
|
||||||
|
|
||||||
|
| Class | Description |
|
||||||
|
|--- |--- |
|
||||||
|
| [GeographicConverter](./classes/DantSu/OpenStreetMapStaticAPI/Utils/GeographicConverter.md) | |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
> Automatically generated from source code comments on 2023-07-30 using [phpDocumentor](http://www.phpdoc.org/)
|
126
vendor/dantsu/php-osm-static-api/src/Circle.php
vendored
Normal file
@ -0,0 +1,126 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace DantSu\OpenStreetMapStaticAPI;
|
||||||
|
|
||||||
|
|
||||||
|
use DantSu\OpenStreetMapStaticAPI\Interfaces\Draw;
|
||||||
|
use DantSu\OpenStreetMapStaticAPI\Utils\GeographicConverter;
|
||||||
|
use DantSu\PHPImageEditor\Geometry2D;
|
||||||
|
use DantSu\PHPImageEditor\Image;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DantSu\OpenStreetMapStaticAPI\Circle draw circle on the map.
|
||||||
|
*
|
||||||
|
* @package DantSu\OpenStreetMapStaticAPI
|
||||||
|
* @author Franck Alary
|
||||||
|
* @access public
|
||||||
|
* @see https://github.com/DantSu/php-osm-static-api Github page of this project
|
||||||
|
*/
|
||||||
|
class Circle implements Draw
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $strokeColor = '000000';
|
||||||
|
/**
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
private $strokeWeight = 1;
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $fillColor = '000000';
|
||||||
|
/**
|
||||||
|
* @var LatLng
|
||||||
|
*/
|
||||||
|
private $center = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var LatLng
|
||||||
|
*/
|
||||||
|
private $edge = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Circle constructor.
|
||||||
|
*
|
||||||
|
* @param LatLng $center Latitude and longitude of the circle center
|
||||||
|
* @param string $strokeColor Hexadecimal string color
|
||||||
|
* @param int $strokeWeight pixel weight of the line
|
||||||
|
* @param string $fillColor Hexadecimal string color
|
||||||
|
*/
|
||||||
|
public function __construct(LatLng $center, string $strokeColor, int $strokeWeight, string $fillColor)
|
||||||
|
{
|
||||||
|
$this->center = $center;
|
||||||
|
$this->edge = $center;
|
||||||
|
$this->strokeColor = \str_replace('#', '', $strokeColor);
|
||||||
|
$this->strokeWeight = $strokeWeight > 0 ? $strokeWeight : 0;
|
||||||
|
$this->fillColor = \str_replace('#', '', $fillColor);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set a latitude and longitude to define the radius of the circle.
|
||||||
|
*
|
||||||
|
* @param LatLng $edge Latitude and longitude of the edge point of a circle
|
||||||
|
* @return $this Fluent interface
|
||||||
|
*/
|
||||||
|
public function setEdgePoint(LatLng $edge): Circle
|
||||||
|
{
|
||||||
|
$this->edge = $edge;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the radius of the circle in meters.
|
||||||
|
*
|
||||||
|
* @param float $radius radius of a circle in meters
|
||||||
|
* @return $this Fluent interface
|
||||||
|
*/
|
||||||
|
public function setRadius(float $radius): Circle
|
||||||
|
{
|
||||||
|
$this->edge = GeographicConverter::metersToLatLng($this->center, $radius, 45);
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Draw the circle on the map image.
|
||||||
|
*
|
||||||
|
* @see https://github.com/DantSu/php-image-editor See more about DantSu\PHPImageEditor\Image
|
||||||
|
*
|
||||||
|
* @param Image $image The map image (An instance of DantSu\PHPImageEditor\Image)
|
||||||
|
* @param MapData $mapData Bounding box of the map
|
||||||
|
* @return $this Fluent interface
|
||||||
|
*/
|
||||||
|
public function draw(Image $image, MapData $mapData): Circle
|
||||||
|
{
|
||||||
|
$center = $mapData->convertLatLngToPxPosition($this->center);
|
||||||
|
$edge = $mapData->convertLatLngToPxPosition($this->edge);
|
||||||
|
|
||||||
|
$angleAndLenght = Geometry2D::getAngleAndLengthFromPoints($center->getX(), $center->getY(), $edge->getX(), $edge->getY());
|
||||||
|
$length = \round($angleAndLenght['length'] + $this->strokeWeight / 2);
|
||||||
|
|
||||||
|
$dImage = Image::newCanvas($image->getWidth(), $image->getHeight());
|
||||||
|
|
||||||
|
if ($this->strokeWeight > 0) {
|
||||||
|
$dImage->drawCircle($center->getX(), $center->getY(), $length * 2, $this->strokeColor);
|
||||||
|
}
|
||||||
|
|
||||||
|
$dImage->drawCircle($center->getX(), $center->getY(), ($length - $this->strokeWeight) * 2, $this->fillColor);
|
||||||
|
|
||||||
|
$image->pasteOn($dImage, 0, 0);
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get bounding box of the shape
|
||||||
|
* @return LatLng[]
|
||||||
|
*/
|
||||||
|
public function getBoundingBox(): array
|
||||||
|
{
|
||||||
|
$distance = GeographicConverter::latLngToMeters($this->center, $this->edge) * 1.4142;
|
||||||
|
return [
|
||||||
|
GeographicConverter::metersToLatLng($this->center, $distance, 315),
|
||||||
|
GeographicConverter::metersToLatLng($this->center, $distance, 135)
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
14
vendor/dantsu/php-osm-static-api/src/Interfaces/Draw.php
vendored
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace DantSu\OpenStreetMapStaticAPI\Interfaces;
|
||||||
|
|
||||||
|
|
||||||
|
use DantSu\OpenStreetMapStaticAPI\MapData;
|
||||||
|
use DantSu\PHPImageEditor\Image;
|
||||||
|
|
||||||
|
interface Draw
|
||||||
|
{
|
||||||
|
public function getBoundingBox(): array;
|
||||||
|
|
||||||
|
public function draw(Image $image, MapData $mapData);
|
||||||
|
}
|
54
vendor/dantsu/php-osm-static-api/src/LatLng.php
vendored
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace DantSu\OpenStreetMapStaticAPI;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DantSu\OpenStreetMapStaticAPI\LatLng define latitude and longitude for map, lines, markers...
|
||||||
|
*
|
||||||
|
* @package DantSu\OpenStreetMapStaticAPI
|
||||||
|
* @author Franck Alary
|
||||||
|
* @access public
|
||||||
|
* @see https://github.com/DantSu/php-osm-static-api Github page of this project
|
||||||
|
*/
|
||||||
|
class LatLng
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var float Latitude
|
||||||
|
*/
|
||||||
|
private $lat = 0.0;
|
||||||
|
/**
|
||||||
|
* @var float Longitude
|
||||||
|
*/
|
||||||
|
private $lng = 0.0;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LatLng constructor.
|
||||||
|
* @param float $lat Latitude
|
||||||
|
* @param float $lng Longitude
|
||||||
|
*/
|
||||||
|
public function __construct(float $lat, float $lng)
|
||||||
|
{
|
||||||
|
$this->lat = $lat;
|
||||||
|
$this->lng = $lng;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get latitude
|
||||||
|
* @return float Latitude
|
||||||
|
*/
|
||||||
|
public function getLat(): float
|
||||||
|
{
|
||||||
|
return $this->lat;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get longitude
|
||||||
|
* @return float Longitude
|
||||||
|
*/
|
||||||
|
public function getLng(): float
|
||||||
|
{
|
||||||
|
return $this->lng;
|
||||||
|
}
|
||||||
|
}
|
90
vendor/dantsu/php-osm-static-api/src/Line.php
vendored
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace DantSu\OpenStreetMapStaticAPI;
|
||||||
|
|
||||||
|
use DantSu\OpenStreetMapStaticAPI\Interfaces\Draw;
|
||||||
|
use DantSu\PHPImageEditor\Image;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DantSu\OpenStreetMapStaticAPI\Line draw line on the map.
|
||||||
|
*
|
||||||
|
* @package DantSu\OpenStreetMapStaticAPI
|
||||||
|
* @author Franck Alary
|
||||||
|
* @access public
|
||||||
|
* @see https://github.com/DantSu/php-osm-static-api Github page of this project
|
||||||
|
*/
|
||||||
|
class Line implements Draw
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $color = '000000';
|
||||||
|
/**
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
private $weight = 1;
|
||||||
|
/**
|
||||||
|
* @var LatLng[]
|
||||||
|
*/
|
||||||
|
private $points = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Line constructor.
|
||||||
|
* @param string $color Hexadecimal string color
|
||||||
|
* @param int $weight pixel weight of the line
|
||||||
|
*/
|
||||||
|
public function __construct(string $color, int $weight)
|
||||||
|
{
|
||||||
|
$this->color = \str_replace('#', '', $color);
|
||||||
|
$this->weight = $weight;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a latitude and longitude to the multi-points line
|
||||||
|
* @param LatLng $latLng Latitude and longitude to add
|
||||||
|
* @return $this Fluent interface
|
||||||
|
*/
|
||||||
|
public function addPoint(LatLng $latLng): Line
|
||||||
|
{
|
||||||
|
$this->points[] = $latLng;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Draw the line on the map image.
|
||||||
|
*
|
||||||
|
* @see https://github.com/DantSu/php-image-editor See more about DantSu\PHPImageEditor\Image
|
||||||
|
*
|
||||||
|
* @param Image $image The map image (An instance of DantSu\PHPImageEditor\Image)
|
||||||
|
* @param MapData $mapData Bounding box of the map
|
||||||
|
* @return $this Fluent interface
|
||||||
|
*/
|
||||||
|
public function draw(Image $image, MapData $mapData): Line
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var $cPoints XY[]
|
||||||
|
*/
|
||||||
|
$cPoints = \array_map(
|
||||||
|
function (LatLng $p) use ($mapData) {
|
||||||
|
return $mapData->convertLatLngToPxPosition($p);
|
||||||
|
},
|
||||||
|
$this->points
|
||||||
|
);
|
||||||
|
|
||||||
|
foreach ($cPoints as $k => $point) {
|
||||||
|
if (isset($cPoints[$k - 1])) {
|
||||||
|
$image->drawLine($cPoints[$k - 1]->getX(), $cPoints[$k - 1]->getY(), $point->getX(), $point->getY(), $this->weight, $this->color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get bounding box of the shape
|
||||||
|
* @return LatLng[]
|
||||||
|
*/
|
||||||
|
public function getBoundingBox(): array
|
||||||
|
{
|
||||||
|
return MapData::getBoundingBoxFromPoints($this->points);
|
||||||
|
}
|
||||||
|
}
|
367
vendor/dantsu/php-osm-static-api/src/MapData.php
vendored
Normal file
@ -0,0 +1,367 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace DantSu\OpenStreetMapStaticAPI;
|
||||||
|
|
||||||
|
|
||||||
|
use DantSu\OpenStreetMapStaticAPI\Utils\GeographicConverter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DantSu\OpenStreetMapStaticAPI\MapData convert latitude and longitude to image pixel position.
|
||||||
|
*
|
||||||
|
* @package DantSu\OpenStreetMapStaticAPI
|
||||||
|
* @author Franck Alary
|
||||||
|
* @access public
|
||||||
|
* @see https://github.com/DantSu/php-osm-static-api Github page of this project
|
||||||
|
*/
|
||||||
|
class MapData
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Convert longitude and zoom to horizontal OpenStreetMap tile number and pixel position.
|
||||||
|
* @param float $lon Longitude
|
||||||
|
* @param int $zoom Zoom
|
||||||
|
* @param int $tileSize Tile size
|
||||||
|
* @return int[] OpenStreetMap tile id and pixel position of the given longitude and zoom
|
||||||
|
*/
|
||||||
|
public static function lngToXTile(float $lon, int $zoom, int $tileSize): array
|
||||||
|
{
|
||||||
|
$x = ($lon + 180) / 360 * \pow(2, $zoom);
|
||||||
|
$tile = \floor($x);
|
||||||
|
return [
|
||||||
|
'id' => $tile,
|
||||||
|
'position' => \round($tileSize * ($x - $tile))
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert latitude and zoom to vertical OpenStreetMap tile number and pixel position.
|
||||||
|
* @param float $lat Latitude
|
||||||
|
* @param int $zoom Zoom
|
||||||
|
* @param int $tileSize Tile size
|
||||||
|
* @return int[] OpenStreetMap tile id and pixel position of the given latitude and zoom
|
||||||
|
*/
|
||||||
|
public static function latToYTile(float $lat, int $zoom, int $tileSize): array
|
||||||
|
{
|
||||||
|
$y = (1 - \log(\tan(\deg2rad($lat)) + 1 / \cos(\deg2rad($lat))) / M_PI) / 2 * \pow(2, $zoom);
|
||||||
|
$tile = \floor($y);
|
||||||
|
return [
|
||||||
|
'id' => $tile,
|
||||||
|
'position' => \round($tileSize * ($y - $tile))
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert horizontal OpenStreetMap tile number ad zoom to longitude.
|
||||||
|
* @param int $id Horizontal OpenStreetMap tile id
|
||||||
|
* @param int $position Horizontal pixel position on tile
|
||||||
|
* @param int $zoom Zoom
|
||||||
|
* @param int $tileSize Tile size
|
||||||
|
* @return float Longitude of the given OpenStreetMap tile id and zoom
|
||||||
|
*/
|
||||||
|
public static function xTileToLng(int $id, int $position, int $zoom, int $tileSize): float
|
||||||
|
{
|
||||||
|
return ($id + $position / $tileSize) / \pow(2, $zoom) * 360 - 180;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert vertical OpenStreetMap tile number and zoom to latitude.
|
||||||
|
* @param int $id Vertical OpenStreetMap tile id
|
||||||
|
* @param int $position Vertical pixel position on tile
|
||||||
|
* @param int $zoom Zoom
|
||||||
|
* @param int $tileSize Tile size
|
||||||
|
* @return float Latitude of the given OpenStreetMap tile id and zoom
|
||||||
|
*/
|
||||||
|
public static function yTileToLat(int $id, int $position, int $zoom, int $tileSize): float
|
||||||
|
{
|
||||||
|
return \rad2deg(\atan(\sinh(M_PI * (1 - 2 * ($id + $position / $tileSize) / \pow(2, $zoom)))));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Transform array of LatLng to bounding box
|
||||||
|
*
|
||||||
|
* @param LatLng[] $points
|
||||||
|
* @return LatLng[]
|
||||||
|
*/
|
||||||
|
public static function getBoundingBoxFromPoints(array $points): array
|
||||||
|
{
|
||||||
|
$minLat = 360;
|
||||||
|
$maxLat = -360;
|
||||||
|
$minLng = 360;
|
||||||
|
$maxLng = -360;
|
||||||
|
foreach ($points as $point) {
|
||||||
|
if ($point->getLat() < $minLat) {
|
||||||
|
$minLat = $point->getLat();
|
||||||
|
}
|
||||||
|
if ($point->getLat() > $maxLat) {
|
||||||
|
$maxLat = $point->getLat();
|
||||||
|
}
|
||||||
|
if ($point->getLng() < $minLng) {
|
||||||
|
$minLng = $point->getLng();
|
||||||
|
}
|
||||||
|
if ($point->getLng() > $maxLng) {
|
||||||
|
$maxLng = $point->getLng();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return [new LatLng($maxLat, $minLng), new LatLng($minLat, $maxLng)];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get center and zoom from two points.
|
||||||
|
*
|
||||||
|
* @param LatLng $topLeft
|
||||||
|
* @param LatLng $bottomRight
|
||||||
|
* @param int $padding
|
||||||
|
* @param int $imageWidth
|
||||||
|
* @param int $imageHeight
|
||||||
|
* @param int $tileSize
|
||||||
|
* @return array center : LatLng, zoom : int
|
||||||
|
*/
|
||||||
|
public static function getCenterAndZoomFromBoundingBox(LatLng $topLeft, LatLng $bottomRight, int $padding, int $imageWidth, int $imageHeight, int $tileSize): array
|
||||||
|
{
|
||||||
|
$zoom = 20;
|
||||||
|
$padding *= 2;
|
||||||
|
$topTilePos = MapData::latToYTile($topLeft->getLat(), $zoom, $tileSize);
|
||||||
|
$bottomTilePos = MapData::latToYTile($bottomRight->getLat(), $zoom, $tileSize);
|
||||||
|
$leftTilePos = MapData::lngToXTile($topLeft->getLng(), $zoom, $tileSize);
|
||||||
|
$rightTilePos = MapData::lngToXTile($bottomRight->getLng(), $zoom, $tileSize);
|
||||||
|
$pxZoneWidth = ($rightTilePos['id'] - $leftTilePos['id']) * $tileSize + $rightTilePos['position'] - $leftTilePos['position'];
|
||||||
|
$pxZoneHeight = ($bottomTilePos['id'] - $topTilePos['id']) * $tileSize + $bottomTilePos['position'] - $topTilePos['position'];
|
||||||
|
|
||||||
|
return [
|
||||||
|
'center' => GeographicConverter::getCenter($topLeft, $bottomRight),
|
||||||
|
'zoom' => \intval(
|
||||||
|
\floor(
|
||||||
|
\log(
|
||||||
|
\min(
|
||||||
|
1,
|
||||||
|
($imageHeight - $padding) / $pxZoneHeight,
|
||||||
|
($imageWidth - $padding) / $pxZoneWidth
|
||||||
|
) * \pow(2, $zoom)
|
||||||
|
) / 0.69314
|
||||||
|
)
|
||||||
|
)
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int zoom
|
||||||
|
*/
|
||||||
|
private $zoom;
|
||||||
|
/**
|
||||||
|
* @var int tile size
|
||||||
|
*/
|
||||||
|
private $tileSize;
|
||||||
|
/**
|
||||||
|
* @var XY Width and height of the image in pixel
|
||||||
|
*/
|
||||||
|
private $outputSize;
|
||||||
|
/**
|
||||||
|
* @var XY top left tile numbers
|
||||||
|
*/
|
||||||
|
private $tileTopLeft;
|
||||||
|
/**
|
||||||
|
* @var XY bottom right tile numbers
|
||||||
|
*/
|
||||||
|
private $tileBottomRight;
|
||||||
|
/**
|
||||||
|
* @var XY left and top pixels to crop to fit final image size
|
||||||
|
*/
|
||||||
|
private $mapCropTopLeft;
|
||||||
|
/**
|
||||||
|
* @var XY bottom and right pixels to crop to fit final image size
|
||||||
|
*/
|
||||||
|
private $mapCropBottomRight;
|
||||||
|
/**
|
||||||
|
* @var LatLng Latitude and longitude of top left image
|
||||||
|
*/
|
||||||
|
private $latLngTopLeft;
|
||||||
|
/**
|
||||||
|
* @var LatLng Latitude and longitude of top right image
|
||||||
|
*/
|
||||||
|
private $latLngTopRight;
|
||||||
|
/**
|
||||||
|
* @var LatLng Latitude and longitude of bottom left image
|
||||||
|
*/
|
||||||
|
private $latLngBottomLeft;
|
||||||
|
/**
|
||||||
|
* @var LatLng Latitude and longitude of bottom right image
|
||||||
|
*/
|
||||||
|
private $latLngBottomRight;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param LatLng $centerMap
|
||||||
|
* @param int $zoom
|
||||||
|
* @param XY $outputSize
|
||||||
|
* @param int $tileSize
|
||||||
|
*/
|
||||||
|
public function __construct(LatLng $centerMap, int $zoom, XY $outputSize, int $tileSize)
|
||||||
|
{
|
||||||
|
$this->zoom = $zoom;
|
||||||
|
$this->outputSize = $outputSize;
|
||||||
|
$this->tileSize = $tileSize;
|
||||||
|
|
||||||
|
$x = static::lngToXTile($centerMap->getLng(), $zoom, $this->tileSize);
|
||||||
|
$y = static::latToYTile($centerMap->getLat(), $zoom, $this->tileSize);
|
||||||
|
|
||||||
|
$startX = \floor($outputSize->getX() / 2 - $x['position']);
|
||||||
|
$startY = \floor($outputSize->getY() / 2 - $y['position']);
|
||||||
|
|
||||||
|
|
||||||
|
$rightSize = $outputSize->getX() - $startX;
|
||||||
|
$bottomSize = $outputSize->getY() - $startY;
|
||||||
|
|
||||||
|
$this->mapCropTopLeft = new XY(
|
||||||
|
$startX < 0 ? \abs($startX) : ($startX % $this->tileSize == 0 ? 0 : $this->tileSize - $startX % $this->tileSize),
|
||||||
|
$startY < 0 ? \abs($startY) : ($startY % $this->tileSize == 0 ? 0 : $this->tileSize - $startY % $this->tileSize)
|
||||||
|
);
|
||||||
|
$this->mapCropBottomRight = new XY(
|
||||||
|
($rightSize % $this->tileSize == 0 ? 0 : $this->tileSize - $rightSize % $this->tileSize),
|
||||||
|
($bottomSize % $this->tileSize == 0 ? 0 : $this->tileSize - $bottomSize % $this->tileSize)
|
||||||
|
);
|
||||||
|
$this->tileTopLeft = new XY(
|
||||||
|
$x['id'] - \ceil($startX / $this->tileSize),
|
||||||
|
$y['id'] - \ceil($startY / $this->tileSize)
|
||||||
|
);
|
||||||
|
$this->tileBottomRight = new XY(
|
||||||
|
$x['id'] - 1 + \ceil($rightSize / $this->tileSize),
|
||||||
|
$y['id'] - 1 + \ceil($bottomSize / $this->tileSize)
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->latLngTopLeft = new LatLng(
|
||||||
|
static::yTileToLat($this->tileTopLeft->getY(), $this->mapCropTopLeft->getY(), $zoom, $this->tileSize),
|
||||||
|
static::xTileToLng($this->tileTopLeft->getX(), $this->mapCropTopLeft->getX(), $zoom, $this->tileSize)
|
||||||
|
);
|
||||||
|
$this->latLngTopRight = new LatLng(
|
||||||
|
static::yTileToLat($this->tileTopLeft->getY(), $this->mapCropTopLeft->getY(), $zoom, $this->tileSize),
|
||||||
|
static::xTileToLng($this->tileBottomRight->getX(), $this->tileSize - $this->mapCropBottomRight->getX(), $zoom, $this->tileSize)
|
||||||
|
);
|
||||||
|
$this->latLngBottomLeft = new LatLng(
|
||||||
|
static::yTileToLat($this->tileBottomRight->getY(), $this->tileSize - $this->mapCropBottomRight->getY(), $zoom, $this->tileSize),
|
||||||
|
static::xTileToLng($this->tileTopLeft->getX(), $this->mapCropTopLeft->getX(), $zoom, $this->tileSize)
|
||||||
|
);
|
||||||
|
$this->latLngBottomRight = new LatLng(
|
||||||
|
static::yTileToLat($this->tileBottomRight->getY(), $this->tileSize - $this->mapCropBottomRight->getY(), $zoom, $this->tileSize),
|
||||||
|
static::xTileToLng($this->tileBottomRight->getX(), $this->tileSize - $this->mapCropBottomRight->getX(), $zoom, $this->tileSize)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get latitude and longitude of top left image
|
||||||
|
* @return LatLng Latitude and longitude of top left image
|
||||||
|
*/
|
||||||
|
public function getLatLngTopLeft(): LatLng
|
||||||
|
{
|
||||||
|
return $this->latLngTopLeft;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get latitude and longitude of top right image
|
||||||
|
* @return LatLng Latitude and longitude of top right image
|
||||||
|
*/
|
||||||
|
public function getLatLngTopRight(): LatLng
|
||||||
|
{
|
||||||
|
return $this->latLngTopRight;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get latitude and longitude of bottom left image
|
||||||
|
* @return LatLng Latitude and longitude of bottom left image
|
||||||
|
*/
|
||||||
|
public function getLatLngBottomLeft(): LatLng
|
||||||
|
{
|
||||||
|
return $this->latLngBottomLeft;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get latitude and longitude of bottom right image
|
||||||
|
* @return LatLng Latitude and longitude of bottom right image
|
||||||
|
*/
|
||||||
|
public function getLatLngBottomRight(): LatLng
|
||||||
|
{
|
||||||
|
return $this->latLngBottomRight;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get width and height of the image in pixel
|
||||||
|
* @return XY Width and height of the image in pixel
|
||||||
|
*/
|
||||||
|
public function getOutputSize(): XY
|
||||||
|
{
|
||||||
|
return $this->outputSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the zoom
|
||||||
|
* @return int zoom
|
||||||
|
*/
|
||||||
|
public function getZoom(): int
|
||||||
|
{
|
||||||
|
return $this->zoom;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get tile size
|
||||||
|
* @return int tile size
|
||||||
|
*/
|
||||||
|
public function getTileSize(): int
|
||||||
|
{
|
||||||
|
return $this->tileSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get top left tile numbers
|
||||||
|
* @return XY top left tile numbers
|
||||||
|
*/
|
||||||
|
public function getTileTopLeft(): XY
|
||||||
|
{
|
||||||
|
return $this->tileTopLeft;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get bottom right tile numbers
|
||||||
|
* @return XY bottom right tile numbers
|
||||||
|
*/
|
||||||
|
public function getTileBottomRight(): XY
|
||||||
|
{
|
||||||
|
return $this->tileBottomRight;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get top left crop pixels
|
||||||
|
* @return XY top left crop pixels
|
||||||
|
*/
|
||||||
|
public function getMapCropTopLeft(): XY
|
||||||
|
{
|
||||||
|
return $this->mapCropTopLeft;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get bottom right crop pixels
|
||||||
|
* @return XY bottom right crop pixels
|
||||||
|
*/
|
||||||
|
public function getMapCropBottomRight(): XY
|
||||||
|
{
|
||||||
|
return $this->mapCropBottomRight;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert a latitude and longitude to a XY pixel position in the image
|
||||||
|
* @param LatLng $latLng Latitude and longitude to be converted
|
||||||
|
* @return XY Pixel position of latitude and longitude in the image
|
||||||
|
*/
|
||||||
|
public function convertLatLngToPxPosition(LatLng $latLng): XY
|
||||||
|
{
|
||||||
|
$x = static::lngToXTile($latLng->getLng(), $this->zoom, $this->tileSize);
|
||||||
|
$y = static::latToYTile($latLng->getLat(), $this->zoom, $this->tileSize);
|
||||||
|
|
||||||
|
return new XY(
|
||||||
|
($x['id'] - $this->tileTopLeft->getX()) * $this->tileSize - $this->mapCropTopLeft->getX() + $x['position'],
|
||||||
|
($y['id'] - $this->tileTopLeft->getY()) * $this->tileSize - $this->mapCropTopLeft->getY() + $y['position']
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
123
vendor/dantsu/php-osm-static-api/src/Markers.php
vendored
Normal file
@ -0,0 +1,123 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace DantSu\OpenStreetMapStaticAPI;
|
||||||
|
|
||||||
|
use DantSu\PHPImageEditor\Image;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DantSu\OpenStreetMapStaticAPI\Markers display markers on the map.
|
||||||
|
*
|
||||||
|
* @package DantSu\OpenStreetMapStaticAPI
|
||||||
|
* @author Franck Alary
|
||||||
|
* @access public
|
||||||
|
* @see https://github.com/DantSu/php-osm-static-api Github page of this project
|
||||||
|
*/
|
||||||
|
class Markers
|
||||||
|
{
|
||||||
|
const ANCHOR_LEFT = 'left';
|
||||||
|
const ANCHOR_CENTER = 'center';
|
||||||
|
const ANCHOR_RIGHT = 'right';
|
||||||
|
const ANCHOR_TOP = 'top';
|
||||||
|
const ANCHOR_MIDDLE = 'middle';
|
||||||
|
const ANCHOR_BOTTOM = 'bottom';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Image Image of the marker
|
||||||
|
*/
|
||||||
|
private $image;
|
||||||
|
/**
|
||||||
|
* @var string|int Horizontal anchor of the marker image
|
||||||
|
*/
|
||||||
|
private $horizontalAnchor = Markers::ANCHOR_CENTER;
|
||||||
|
/**
|
||||||
|
* @var string|int Vertical anchor of the marker image
|
||||||
|
*/
|
||||||
|
private $verticalAnchor = Markers::ANCHOR_MIDDLE;
|
||||||
|
/**
|
||||||
|
* @var LatLng[] Latitudes and longitudes of the markers
|
||||||
|
*/
|
||||||
|
private $coordinates = [];
|
||||||
|
|
||||||
|
public function __construct($pathImage)
|
||||||
|
{
|
||||||
|
$this->image = Image::fromPath($pathImage);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a marker on the map.
|
||||||
|
* @param LatLng $coordinate Latitude and longitude of the marker
|
||||||
|
* @return $this Fluent interface
|
||||||
|
*/
|
||||||
|
public function addMarker(LatLng $coordinate): Markers
|
||||||
|
{
|
||||||
|
$this->coordinates[] = $coordinate;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define the anchor point of the image marker.
|
||||||
|
* @param int|string $horizontalAnchor Horizontal anchor in pixel or you can use `Markers::ANCHOR_LEFT`, `Markers::ANCHOR_CENTER`, `Markers::ANCHOR_RIGHT`
|
||||||
|
* @param int|string $verticalAnchor Vertical anchor in pixel or you can use `Markers::ANCHOR_TOP`, `Markers::ANCHOR_MIDDLE`, `Markers::ANCHOR_BOTTOM`
|
||||||
|
* @return $this Fluent interface
|
||||||
|
*/
|
||||||
|
public function setAnchor($horizontalAnchor, $verticalAnchor): Markers
|
||||||
|
{
|
||||||
|
$this->horizontalAnchor = $horizontalAnchor;
|
||||||
|
$this->verticalAnchor = $verticalAnchor;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Draw markers on the image map.
|
||||||
|
*
|
||||||
|
* @see https://github.com/DantSu/php-image-editor See more about DantSu\PHPImageEditor\Image
|
||||||
|
* @param Image $image The map image (An instance of DantSu\PHPImageEditor\Image)
|
||||||
|
* @param MapData $mapData Bounding box of the map
|
||||||
|
* @return $this Fluent interface
|
||||||
|
*/
|
||||||
|
public function draw(Image $image, MapData $mapData): Markers
|
||||||
|
{
|
||||||
|
$imageMarginLeft = $this->horizontalAnchor;
|
||||||
|
switch ($imageMarginLeft) {
|
||||||
|
case Markers::ANCHOR_LEFT:
|
||||||
|
$imageMarginLeft = 0;
|
||||||
|
break;
|
||||||
|
case Markers::ANCHOR_CENTER:
|
||||||
|
$imageMarginLeft = $this->image->getWidth() / 2;
|
||||||
|
break;
|
||||||
|
case Markers::ANCHOR_RIGHT:
|
||||||
|
$imageMarginLeft = $this->image->getWidth();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
$imageMarginTop = $this->verticalAnchor;
|
||||||
|
switch ($imageMarginTop) {
|
||||||
|
case Markers::ANCHOR_TOP:
|
||||||
|
$imageMarginTop = 0;
|
||||||
|
break;
|
||||||
|
case Markers::ANCHOR_MIDDLE:
|
||||||
|
$imageMarginTop = $this->image->getHeight() / 2;
|
||||||
|
break;
|
||||||
|
case Markers::ANCHOR_BOTTOM:
|
||||||
|
$imageMarginTop = $this->image->getHeight();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($this->coordinates as $coordinate) {
|
||||||
|
$xy = $mapData->convertLatLngToPxPosition($coordinate);
|
||||||
|
$image->pasteOn($this->image, $xy->getX() + 1 - $imageMarginLeft, $xy->getY() + 1 - $imageMarginTop);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get bounding box of markers
|
||||||
|
* @return LatLng[]
|
||||||
|
*/
|
||||||
|
public function getBoundingBox(): array
|
||||||
|
{
|
||||||
|
return MapData::getBoundingBoxFromPoints($this->coordinates);
|
||||||
|
}
|
||||||
|
}
|
283
vendor/dantsu/php-osm-static-api/src/OpenStreetMap.php
vendored
Normal file
@ -0,0 +1,283 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace DantSu\OpenStreetMapStaticAPI;
|
||||||
|
|
||||||
|
use DantSu\OpenStreetMapStaticAPI\Interfaces\Draw;
|
||||||
|
use DantSu\PHPImageEditor\Image;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DantSu\OpenStreetMapStaticAPI\OpenStreetMap is a PHP library created for easily get static image from OpenStreetMap with markers, lines, polygons and circles.
|
||||||
|
*
|
||||||
|
* @package DantSu\OpenStreetMapStaticAPI
|
||||||
|
* @author Franck Alary
|
||||||
|
* @access public
|
||||||
|
* @see https://github.com/DantSu/php-osm-static-api Github page of this project
|
||||||
|
*/
|
||||||
|
class OpenStreetMap
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Create new instance of OpenStreetMap.
|
||||||
|
* @param LatLng $centerMap Latitude and longitude of the map center
|
||||||
|
* @param int $zoom Zoom
|
||||||
|
* @param int $imageWidth Width of the generated map image
|
||||||
|
* @param int $imageHeight Height of the generated map image
|
||||||
|
* @param TileLayer $tileLayer Tile server configuration, defaults to OpenStreetMaps tile server
|
||||||
|
* @param int $tileSize Tile size in pixels
|
||||||
|
*/
|
||||||
|
public static function createFromLatLngZoom(LatLng $centerMap, int $zoom, int $imageWidth, int $imageHeight, TileLayer $tileLayer = null, int $tileSize = 256): OpenStreetMap
|
||||||
|
{
|
||||||
|
return new OpenStreetMap($centerMap, $zoom, $imageWidth, $imageHeight, $tileLayer, $tileSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create new instance of OpenStreetMap.
|
||||||
|
* @param LatLng $topLeft Latitude and longitude of the map top left
|
||||||
|
* @param LatLng $bottomRight Latitude and longitude of the map bottom right
|
||||||
|
* @param int $padding Padding to add before top left and after bottom right position.
|
||||||
|
* @param int $imageWidth Width of the generated map image
|
||||||
|
* @param int $imageHeight Height of the generated map image
|
||||||
|
* @param TileLayer $tileLayer Tile server configuration, defaults to OpenStreetMaps tile server
|
||||||
|
* @param int $tileSize Tile size in pixels
|
||||||
|
* @return OpenStreetMap
|
||||||
|
*/
|
||||||
|
public static function createFromBoundingBox(LatLng $topLeft, LatLng $bottomRight, int $padding, int $imageWidth, int $imageHeight, TileLayer $tileLayer = null, int $tileSize = 256): OpenStreetMap
|
||||||
|
{
|
||||||
|
if ($tileLayer === null) {
|
||||||
|
$tileLayer = TileLayer::defaultTileLayer();
|
||||||
|
}
|
||||||
|
|
||||||
|
$latLngZoom = MapData::getCenterAndZoomFromBoundingBox($topLeft, $bottomRight, $padding, $imageWidth, $imageHeight, $tileSize);
|
||||||
|
return new OpenStreetMap($latLngZoom['center'], $latLngZoom['zoom'], $imageWidth, $imageHeight, $tileLayer, $tileSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var MapData Data about the generated map (bounding box, size, OSM tile ids...)
|
||||||
|
*/
|
||||||
|
protected $mapData;
|
||||||
|
/**
|
||||||
|
* @var TileLayer[] Array of TileLayer instances
|
||||||
|
*/
|
||||||
|
protected $layers = [];
|
||||||
|
/**
|
||||||
|
* @var Markers[] Array of Markers instances
|
||||||
|
*/
|
||||||
|
protected $markers = [];
|
||||||
|
/**
|
||||||
|
* @var Draw[] Array of Line instances
|
||||||
|
*/
|
||||||
|
protected $draws = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* OpenStreetMap constructor.
|
||||||
|
* @param LatLng $centerMap Latitude and longitude of the map center
|
||||||
|
* @param int $zoom Zoom
|
||||||
|
* @param int $imageWidth Width of the generated map image
|
||||||
|
* @param int $imageHeight Height of the generated map image
|
||||||
|
* @param TileLayer $tileLayer Tile server configuration, defaults to OpenStreetMaps tile server
|
||||||
|
* @param int $tileSize Tile size in pixels
|
||||||
|
*/
|
||||||
|
public function __construct(LatLng $centerMap, int $zoom, int $imageWidth, int $imageHeight, TileLayer $tileLayer = null, int $tileSize = 256)
|
||||||
|
{
|
||||||
|
if ($tileLayer === null) {
|
||||||
|
$tileLayer = TileLayer::defaultTileLayer();
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->mapData = new MapData($centerMap, $tileLayer->checkZoom($zoom), new XY($imageWidth, $imageHeight), $tileSize);
|
||||||
|
$this->layers = [$tileLayer];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add tile layer to the map
|
||||||
|
* @param TileLayer $layer An instance of TileLayer
|
||||||
|
* @return $this Fluent interface
|
||||||
|
*/
|
||||||
|
public function addLayer(TileLayer $layer)
|
||||||
|
{
|
||||||
|
$this->layers[] = $layer;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add markers on the map
|
||||||
|
* @param Markers $markers An instance of Markers
|
||||||
|
* @return $this Fluent interface
|
||||||
|
*/
|
||||||
|
public function addMarkers(Markers $markers)
|
||||||
|
{
|
||||||
|
$this->markers[] = $markers;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a line on the map
|
||||||
|
* @param Draw $draw An instance of Line
|
||||||
|
* @return $this Fluent interface
|
||||||
|
*/
|
||||||
|
public function addDraw(Draw $draw)
|
||||||
|
{
|
||||||
|
$this->draws[] = $draw;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fit map to draws.
|
||||||
|
*
|
||||||
|
* @param int $padding Padding in pixel
|
||||||
|
* @return $this Fluent interface
|
||||||
|
*/
|
||||||
|
public function fitToDraws(int $padding = 0)
|
||||||
|
{
|
||||||
|
$points = [];
|
||||||
|
foreach ($this->draws as $draw) {
|
||||||
|
$points = \array_merge($points, $draw->getBoundingBox());
|
||||||
|
}
|
||||||
|
return $this->fitToPoints($points, $padding);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fit map to markers.
|
||||||
|
*
|
||||||
|
* @param int $padding Padding in pixel
|
||||||
|
* @return $this Fluent interface
|
||||||
|
*/
|
||||||
|
public function fitToMarkers(int $padding = 0)
|
||||||
|
{
|
||||||
|
$points = [];
|
||||||
|
foreach ($this->markers as $markers) {
|
||||||
|
$points = \array_merge($points, $markers->getBoundingBox());
|
||||||
|
}
|
||||||
|
return $this->fitToPoints($points, $padding);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fit map to draws and markers.
|
||||||
|
*
|
||||||
|
* @param int $padding Padding in pixel
|
||||||
|
* @return $this Fluent interface
|
||||||
|
*/
|
||||||
|
public function fitToMarkersAndDraws(int $padding = 0)
|
||||||
|
{
|
||||||
|
$points = [];
|
||||||
|
foreach ($this->draws as $draw) {
|
||||||
|
$points = \array_merge($points, $draw->getBoundingBox());
|
||||||
|
}
|
||||||
|
foreach ($this->markers as $markers) {
|
||||||
|
$points = \array_merge($points, $markers->getBoundingBox());
|
||||||
|
}
|
||||||
|
return $this->fitToPoints($points, $padding);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fit map to an array of points.
|
||||||
|
*
|
||||||
|
* @param LatLng[] $points LatLng points
|
||||||
|
* @param int $padding Padding in pixel
|
||||||
|
* @return $this Fluent interface
|
||||||
|
*/
|
||||||
|
public function fitToPoints(array $points, int $padding = 0)
|
||||||
|
{
|
||||||
|
$outputSize = $this->mapData->getOutputSize();
|
||||||
|
$tileSize = $this->mapData->getTileSize();
|
||||||
|
$boundingBox = MapData::getBoundingBoxFromPoints($points);
|
||||||
|
$latLngZoom = MapData::getCenterAndZoomFromBoundingBox($boundingBox[0], $boundingBox[1], $padding, $outputSize->getX(), $outputSize->getY(), $tileSize);
|
||||||
|
$this->mapData = new MapData($latLngZoom['center'], $this->layers[0]->checkZoom($latLngZoom['zoom']), $outputSize, $tileSize);
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get data about the generated map (bounding box, size, OSM tile ids...)
|
||||||
|
* @see https://github.com/DantSu/php-osm-static-api/blob/master/docs/classes/DantSu/OpenStreetMapStaticAPI/MapData.md See more about MapData
|
||||||
|
* @return MapData data about the generated map (bounding box, size, OSM tile ids...)
|
||||||
|
*/
|
||||||
|
public function getMapData(): MapData
|
||||||
|
{
|
||||||
|
return $this->mapData;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get only the map image.
|
||||||
|
* @see https://github.com/DantSu/php-image-editor See more about DantSu\PHPImageEditor\Image
|
||||||
|
* @return Image An instance of DantSu\PHPImageEditor\Image
|
||||||
|
*/
|
||||||
|
protected function getMapImage(): Image
|
||||||
|
{
|
||||||
|
$imgSize = $this->mapData->getOutputSize();
|
||||||
|
$startX = $this->mapData->getMapCropTopLeft()->getX() * -1;
|
||||||
|
$startY = $this->mapData->getMapCropTopLeft()->getY() * -1;
|
||||||
|
|
||||||
|
$image = Image::newCanvas($imgSize->getX(), $imgSize->getY());
|
||||||
|
$tileSize = $this->mapData->getTileSize();
|
||||||
|
|
||||||
|
foreach ($this->layers as $tileLayer) {
|
||||||
|
$yTile = $this->mapData->getTileTopLeft()->getY();
|
||||||
|
for ($y = $startY; $y < $imgSize->getY(); $y += $tileSize) {
|
||||||
|
$xTile = $this->mapData->getTileTopLeft()->getX();
|
||||||
|
for ($x = $startX; $x < $imgSize->getX(); $x += $tileSize) {
|
||||||
|
$image->pasteOn(
|
||||||
|
$tileLayer->getTile($xTile, $yTile, $this->mapData->getZoom(), $tileSize),
|
||||||
|
$x,
|
||||||
|
$y
|
||||||
|
);
|
||||||
|
++$xTile;
|
||||||
|
}
|
||||||
|
++$yTile;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $image;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Draw OpenStreetMap attribution at the right bottom of the image
|
||||||
|
* @param Image $image The image of the map
|
||||||
|
* @return Image The image of the map with attribution
|
||||||
|
*/
|
||||||
|
protected function drawAttribution(Image $image): Image
|
||||||
|
{
|
||||||
|
$margin = 5;
|
||||||
|
$attribution = function (Image $image, $margin): array {
|
||||||
|
return $image->writeTextAndGetBoundingBox(
|
||||||
|
\implode(
|
||||||
|
' - ',
|
||||||
|
\array_map(function ($layer) {
|
||||||
|
return $layer->getAttributionText();
|
||||||
|
}, $this->layers)
|
||||||
|
),
|
||||||
|
__DIR__ . '/resources/font.ttf',
|
||||||
|
10,
|
||||||
|
'0078A8',
|
||||||
|
$margin,
|
||||||
|
$margin,
|
||||||
|
Image::ALIGN_LEFT,
|
||||||
|
Image::ALIGN_TOP
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
$bbox = $attribution(Image::newCanvas(1, 1), $margin);
|
||||||
|
$imageAttribution = Image::newCanvas($bbox['bottom-right']['x'] + $margin, $bbox['bottom-right']['y'] + $margin);
|
||||||
|
$imageAttribution->drawRectangle(0, 0, $imageAttribution->getWidth(), $imageAttribution->getHeight(), 'FFFFFF33');
|
||||||
|
$attribution($imageAttribution, $margin);
|
||||||
|
|
||||||
|
return $image->pasteOn($imageAttribution, Image::ALIGN_RIGHT, Image::ALIGN_BOTTOM);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the map image with markers and lines.
|
||||||
|
*
|
||||||
|
* @see https://github.com/DantSu/php-image-editor See more about DantSu\PHPImageEditor\Image
|
||||||
|
* @return Image An instance of DantSu\PHPImageEditor\Image
|
||||||
|
*/
|
||||||
|
public function getImage(): Image
|
||||||
|
{
|
||||||
|
$image = $this->getMapImage();
|
||||||
|
|
||||||
|
foreach ($this->draws as $line) {
|
||||||
|
$line->draw($image, $this->mapData);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($this->markers as $markers) {
|
||||||
|
$markers->draw($image, $this->mapData);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->drawAttribution($image);
|
||||||
|
}
|
||||||
|
}
|
120
vendor/dantsu/php-osm-static-api/src/Polygon.php
vendored
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace DantSu\OpenStreetMapStaticAPI;
|
||||||
|
|
||||||
|
|
||||||
|
use DantSu\OpenStreetMapStaticAPI\Interfaces\Draw;
|
||||||
|
use DantSu\PHPImageEditor\Image;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DantSu\OpenStreetMapStaticAPI\Polygon draw polygon on the map.
|
||||||
|
*
|
||||||
|
* @package DantSu\OpenStreetMapStaticAPI
|
||||||
|
* @author Franck Alary
|
||||||
|
* @access public
|
||||||
|
* @see https://github.com/DantSu/php-osm-static-api Github page of this project
|
||||||
|
*/
|
||||||
|
class Polygon implements Draw
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $strokeColor = '000000';
|
||||||
|
/**
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
private $strokeWeight = 1;
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $fillColor = '000000';
|
||||||
|
/**
|
||||||
|
* @var LatLng[]
|
||||||
|
*/
|
||||||
|
private $points = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Polygon constructor.
|
||||||
|
* @param string $strokeColor Hexadecimal string color
|
||||||
|
* @param int $strokeWeight pixel weight of the line
|
||||||
|
* @param string $fillColor Hexadecimal string color
|
||||||
|
*/
|
||||||
|
public function __construct(string $strokeColor, int $strokeWeight, string $fillColor)
|
||||||
|
{
|
||||||
|
$this->strokeColor = \str_replace('#', '', $strokeColor);
|
||||||
|
$this->strokeWeight = $strokeWeight > 0 ? $strokeWeight : 0;
|
||||||
|
$this->fillColor = \str_replace('#', '', $fillColor);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a latitude and longitude to the polygon
|
||||||
|
* @param LatLng $latLng Latitude and longitude to add
|
||||||
|
* @return $this Fluent interface
|
||||||
|
*/
|
||||||
|
public function addPoint(LatLng $latLng): Polygon
|
||||||
|
{
|
||||||
|
$this->points[] = $latLng;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Draw the polygon on the map image.
|
||||||
|
*
|
||||||
|
* @see https://github.com/DantSu/php-image-editor See more about DantSu\PHPImageEditor\Image
|
||||||
|
*
|
||||||
|
* @param Image $image The map image (An instance of DantSu\PHPImageEditor\Image)
|
||||||
|
* @param MapData $mapData Bounding box of the map
|
||||||
|
* @return $this Fluent interface
|
||||||
|
*/
|
||||||
|
public function draw(Image $image, MapData $mapData): Polygon
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var $cPoints XY[]
|
||||||
|
*/
|
||||||
|
$cPoints = \array_map(
|
||||||
|
function (LatLng $p) use ($mapData) {
|
||||||
|
return $mapData->convertLatLngToPxPosition($p);
|
||||||
|
},
|
||||||
|
$this->points
|
||||||
|
);
|
||||||
|
|
||||||
|
$image->pasteOn(
|
||||||
|
Image::newCanvas($image->getWidth(), $image->getHeight())
|
||||||
|
->drawPolygon(
|
||||||
|
\array_reduce(
|
||||||
|
$cPoints,
|
||||||
|
function (array $acc, XY $p) {
|
||||||
|
$acc[] = $p->getX();
|
||||||
|
$acc[] = $p->getY();
|
||||||
|
return $acc;
|
||||||
|
},
|
||||||
|
[]
|
||||||
|
),
|
||||||
|
$this->fillColor
|
||||||
|
),
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
);
|
||||||
|
|
||||||
|
if ($this->strokeWeight > 0) {
|
||||||
|
foreach ($cPoints as $k => $point) {
|
||||||
|
$pK = $k - 1;
|
||||||
|
if (!isset($cPoints[$pK])) {
|
||||||
|
$pK = \count($cPoints) - 1;
|
||||||
|
}
|
||||||
|
$image->drawLine($cPoints[$pK]->getX(), $cPoints[$pK]->getY(), $point->getX(), $point->getY(), $this->strokeWeight, $this->strokeColor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get bounding box of the shape
|
||||||
|
* @return LatLng[]
|
||||||
|
*/
|
||||||
|
public function getBoundingBox(): array
|
||||||
|
{
|
||||||
|
return MapData::getBoundingBoxFromPoints($this->points);
|
||||||
|
}
|
||||||
|
}
|
206
vendor/dantsu/php-osm-static-api/src/TileLayer.php
vendored
Normal file
@ -0,0 +1,206 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace DantSu\OpenStreetMapStaticAPI;
|
||||||
|
|
||||||
|
use DantSu\PHPImageEditor\Image;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DantSu\OpenStreetMapStaticAPI\TileLayer define tile server url and related configuration
|
||||||
|
*
|
||||||
|
* @package DantSu\OpenStreetMapStaticAPI
|
||||||
|
* @author Stephan Strate <hello@stephan.codes>
|
||||||
|
* @access public
|
||||||
|
* @see https://github.com/DantSu/php-osm-static-api Github page of this project
|
||||||
|
*/
|
||||||
|
class TileLayer
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default tile server. OpenStreetMaps with related attribution text
|
||||||
|
* @return TileLayer default tile server
|
||||||
|
*/
|
||||||
|
public static function defaultTileLayer(): TileLayer
|
||||||
|
{
|
||||||
|
return new TileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', '© OpenStreetMap contributors');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string Tile server url, defaults to OpenStreetMap tile server
|
||||||
|
*/
|
||||||
|
protected $url;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string Tile server attribution according to license
|
||||||
|
*/
|
||||||
|
protected $attributionText;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string[] Tile server subdomains
|
||||||
|
*/
|
||||||
|
protected $subdomains;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var float Opacity
|
||||||
|
*/
|
||||||
|
protected $opacity = 1;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @var int Max zoom value
|
||||||
|
*/
|
||||||
|
protected $maxZoom = 20;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @var int Min zoom value
|
||||||
|
*/
|
||||||
|
protected $minZoom = 0;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @array $curlOptions Array of curl options
|
||||||
|
*/
|
||||||
|
protected $curlOptions = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @bool $failCurlOnError If true, curl will throw an exception on error.
|
||||||
|
*/
|
||||||
|
protected $failCurlOnError = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TileLayer constructor
|
||||||
|
* @param string $url tile server url with placeholders (`x`, `y`, `z`, `r`, `s`)
|
||||||
|
* @param string $attributionText tile server attribution text
|
||||||
|
* @param string $subdomains tile server subdomains
|
||||||
|
* @param array $curlOptions Array of curl options
|
||||||
|
* @param bool $failCurlOnError If true, curl will throw an exception on error.
|
||||||
|
*/
|
||||||
|
public function __construct(string $url, string $attributionText, string $subdomains = 'abc', array $curlOptions = [], bool $failCurlOnError = false)
|
||||||
|
{
|
||||||
|
$this->url = $url;
|
||||||
|
$this->attributionText = $attributionText;
|
||||||
|
$this->subdomains = \str_split($subdomains);
|
||||||
|
$this->curlOptions = $curlOptions;
|
||||||
|
$this->failCurlOnError = $failCurlOnError;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set opacity of the layer
|
||||||
|
* @param float $opacity Opacity value (0 to 1)
|
||||||
|
* @return $this Fluent interface
|
||||||
|
*/
|
||||||
|
public function setOpacity(float $opacity)
|
||||||
|
{
|
||||||
|
$this->opacity = $opacity;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set a max zoom value
|
||||||
|
* @param int $maxZoom
|
||||||
|
* @return $this Fluent interface
|
||||||
|
*/
|
||||||
|
public function setMaxZoom(int $maxZoom)
|
||||||
|
{
|
||||||
|
$this->maxZoom = $maxZoom;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get max zoom value
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function getMaxZoom(): int
|
||||||
|
{
|
||||||
|
return $this->maxZoom;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set a min zoom value
|
||||||
|
* @param int $minZoom
|
||||||
|
* @return $this Fluent interface
|
||||||
|
*/
|
||||||
|
public function setMinZoom(int $minZoom)
|
||||||
|
{
|
||||||
|
$this->minZoom = $minZoom;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get min zoom value
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function getMinZoom(): int
|
||||||
|
{
|
||||||
|
return $this->minZoom;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if zoom value is between min zoom and max zoom
|
||||||
|
* @param int $zoom Zoom value to be checked
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function checkZoom(int $zoom): int
|
||||||
|
{
|
||||||
|
return \min(\max($zoom, $this->minZoom), $this->maxZoom);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get tile url for coordinates and zoom level
|
||||||
|
* @param int $x x coordinate
|
||||||
|
* @param int $y y coordinate
|
||||||
|
* @param int $z zoom level
|
||||||
|
* @return string tile url
|
||||||
|
*/
|
||||||
|
public function getTileUrl(int $x, int $y, int $z): string
|
||||||
|
{
|
||||||
|
return \str_replace(
|
||||||
|
['{r}', '{s}', '{x}', '{y}', '{z}'],
|
||||||
|
['', $this->getSubdomain($x, $y), $x, $y, $z],
|
||||||
|
$this->url
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Select subdomain of tile server to prevent rate limiting on remote server
|
||||||
|
* @param int $x x coordinate
|
||||||
|
* @param int $y y coordinate
|
||||||
|
* @return string selected subdomain
|
||||||
|
* @see https://github.com/Leaflet/Leaflet/blob/main/src/layer/tile/TileLayer.js#L233 Leaflet implementation
|
||||||
|
*/
|
||||||
|
protected function getSubdomain(int $x, int $y): string
|
||||||
|
{
|
||||||
|
return $this->subdomains[\abs($x + $y) % \sizeof($this->subdomains)];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get attribution text
|
||||||
|
* @return string Attribution text
|
||||||
|
*/
|
||||||
|
public function getAttributionText(): string
|
||||||
|
{
|
||||||
|
return $this->attributionText;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get an image tile
|
||||||
|
* @param float $x
|
||||||
|
* @param float $y
|
||||||
|
* @param int $z
|
||||||
|
* @param int $tileSize
|
||||||
|
* @return Image Image instance containing the tile
|
||||||
|
* @throws \Exception
|
||||||
|
*/
|
||||||
|
public function getTile(float $x, float $y, int $z, int $tileSize): Image
|
||||||
|
{
|
||||||
|
if($this->opacity == 0) {
|
||||||
|
return Image::newCanvas($tileSize, $tileSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
$tile = Image::fromCurl($this->getTileUrl($x, $y, $z),$this->curlOptions, $this->failCurlOnError);
|
||||||
|
|
||||||
|
if($this->opacity > 0 && $this->opacity < 1) {
|
||||||
|
$tile->setOpacity($this->opacity);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $tile;
|
||||||
|
}
|
||||||
|
}
|
101
vendor/dantsu/php-osm-static-api/src/Utils/GeographicConverter.php
vendored
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace DantSu\OpenStreetMapStaticAPI\Utils;
|
||||||
|
|
||||||
|
|
||||||
|
use DantSu\OpenStreetMapStaticAPI\LatLng;
|
||||||
|
|
||||||
|
class GeographicConverter
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Calculate the earth radius at the given latitude
|
||||||
|
*
|
||||||
|
* @param float $lat
|
||||||
|
* @return float
|
||||||
|
*/
|
||||||
|
public static function earthRadiusAtLatitude(float $lat): float
|
||||||
|
{
|
||||||
|
$equatorial = 6378137.0;
|
||||||
|
$pole = 6356752.3;
|
||||||
|
$lat = \deg2rad($lat);
|
||||||
|
|
||||||
|
return \sqrt(
|
||||||
|
(\pow(\pow($equatorial, 2) * \cos($lat), 2) + \pow(\pow($pole, 2) * \sin($lat), 2)) /
|
||||||
|
(\pow($equatorial * \cos($lat), 2) + \pow($pole * \sin($lat), 2))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert distance and angle from a point to latitude and longitude
|
||||||
|
* 0 : top, 90 : right; 180 : bottom, 270 : left
|
||||||
|
*
|
||||||
|
* @param LatLng $from Starting coordinate
|
||||||
|
* @param float $distance Distance in meters
|
||||||
|
* @param float $angle Angle in degrees
|
||||||
|
* @return LatLng
|
||||||
|
*/
|
||||||
|
public static function metersToLatLng(LatLng $from, float $distance, float $angle): LatLng
|
||||||
|
{
|
||||||
|
$earthRadius = self::earthRadiusAtLatitude($from->getLat());
|
||||||
|
$lat = \deg2rad($from->getLat());
|
||||||
|
$lng = \deg2rad($from->getLng());
|
||||||
|
$angle = \deg2rad($angle);
|
||||||
|
|
||||||
|
return new LatLng(
|
||||||
|
\rad2deg(
|
||||||
|
\asin(
|
||||||
|
\sin($lat) * \cos($distance / $earthRadius) +
|
||||||
|
\cos($lat) * \sin($distance / $earthRadius) * \cos($angle)
|
||||||
|
)
|
||||||
|
),
|
||||||
|
\rad2deg(
|
||||||
|
$lng + \atan2(
|
||||||
|
\sin($angle) * \sin($distance / $earthRadius) * \cos($lat),
|
||||||
|
\cos($distance / $earthRadius) - \sin($lat) * \sin($lat)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get distance in meters between two points.
|
||||||
|
*
|
||||||
|
* @param LatLng $from Starting coordinate
|
||||||
|
* @param LatLng $end Ending coordinate
|
||||||
|
* @return float
|
||||||
|
*/
|
||||||
|
public static function latLngToMeters(LatLng $from, LatLng $end): float
|
||||||
|
{
|
||||||
|
$earthRadius = self::earthRadiusAtLatitude($from->getLat());
|
||||||
|
$lat1 = \deg2rad($from->getLat());
|
||||||
|
$lat2 = \deg2rad($end->getLat());
|
||||||
|
$lat = \deg2rad($end->getLat() - $from->getLat());
|
||||||
|
$lng = \deg2rad($end->getLng() - $from->getLng());
|
||||||
|
|
||||||
|
$a = \pow(\sin($lat / 2), 2) + \cos($lat1) * \cos($lat2) * \pow(\sin($lng / 2), 2);
|
||||||
|
return \abs($earthRadius * 2 * \atan2(\sqrt($a), \sqrt(1 - $a)));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get center between two coordinates.
|
||||||
|
* @param LatLng $point1 Vertical OpenStreetMap tile id
|
||||||
|
* @param LatLng $point2 Vertical pixel position on tile
|
||||||
|
* @return LatLng midpoint between the given coordinates
|
||||||
|
*/
|
||||||
|
public static function getCenter(LatLng $point1, LatLng $point2): LatLng
|
||||||
|
{
|
||||||
|
//return new LatLng(($point1->getLat() + $point2->getLat()) / 2, ($point1->getLng() + $point2->getLng()) / 2);
|
||||||
|
$dLng = \deg2rad($point2->getLng() - $point1->getLng());
|
||||||
|
$lat1 = \deg2rad($point1->getLat());
|
||||||
|
$lat2 = \deg2rad($point2->getLat());
|
||||||
|
$lng1 = \deg2rad($point1->getLng());
|
||||||
|
$bx = \cos($lat2) * \cos($dLng);
|
||||||
|
$by = \cos($lat2) * \sin($dLng);
|
||||||
|
return new LatLng(
|
||||||
|
\rad2deg(\atan2(\sin($lat1) + \sin($lat2), \sqrt(\pow(\cos($lat1) + $bx, 2) + \pow($by, 2)))),
|
||||||
|
\rad2deg($lng1 + \atan2($by, \cos($lat1) + $bx))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
52
vendor/dantsu/php-osm-static-api/src/XY.php
vendored
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace DantSu\OpenStreetMapStaticAPI;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DantSu\OpenStreetMapStaticAPI\XY define X and Y pixel position for map, lines, markers...
|
||||||
|
*
|
||||||
|
* @package DantSu\OpenStreetMapStaticAPI
|
||||||
|
* @author Franck Alary
|
||||||
|
* @access public
|
||||||
|
* @see https://github.com/DantSu/php-osm-static-api Github page of this project
|
||||||
|
*/
|
||||||
|
class XY
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var int X
|
||||||
|
*/
|
||||||
|
private $x = 0;
|
||||||
|
/**
|
||||||
|
* @var int Y
|
||||||
|
*/
|
||||||
|
private $y = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* XY constructor.
|
||||||
|
* @param int $x X
|
||||||
|
* @param int $y Y
|
||||||
|
*/
|
||||||
|
public function __construct(int $x, int $y)
|
||||||
|
{
|
||||||
|
$this->x = $x;
|
||||||
|
$this->y = $y;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get X
|
||||||
|
* @return int X
|
||||||
|
*/
|
||||||
|
public function getX(): int
|
||||||
|
{
|
||||||
|
return $this->x;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Y
|
||||||
|
* @return int Y
|
||||||
|
*/
|
||||||
|
public function getY(): int
|
||||||
|
{
|
||||||
|
return $this->y;
|
||||||
|
}
|
||||||
|
}
|
BIN
vendor/dantsu/php-osm-static-api/src/resources/font.ttf
vendored
Normal file
BIN
vendor/dantsu/php-osm-static-api/src/samples/resources/marker.png
vendored
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
vendor/dantsu/php-osm-static-api/src/samples/resources/marker2.png
vendored
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
vendor/dantsu/php-osm-static-api/src/samples/resources/sample1.png
vendored
Normal file
After Width: | Height: | Size: 232 KiB |
BIN
vendor/dantsu/php-osm-static-api/src/samples/resources/sample4.png
vendored
Normal file
After Width: | Height: | Size: 132 KiB |
37
vendor/dantsu/php-osm-static-api/src/samples/sample1.php
vendored
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
require_once '../../vendor/autoload.php';
|
||||||
|
|
||||||
|
require_once '../MapData.php';
|
||||||
|
require_once '../LatLng.php';
|
||||||
|
require_once '../Polygon.php';
|
||||||
|
require_once '../Markers.php';
|
||||||
|
require_once '../OpenStreetMap.php';
|
||||||
|
require_once '../XY.php';
|
||||||
|
|
||||||
|
use \DantSu\OpenStreetMapStaticAPI\OpenStreetMap;
|
||||||
|
use \DantSu\OpenStreetMapStaticAPI\LatLng;
|
||||||
|
use \DantSu\OpenStreetMapStaticAPI\Polygon;
|
||||||
|
use \DantSu\OpenStreetMapStaticAPI\Markers;
|
||||||
|
|
||||||
|
\header('Content-type: image/png');
|
||||||
|
OpenStreetMap::createFromBoundingBox(new LatLng(44.352887, 2.565672), new LatLng(44.351172, 2.571092), 10, 600, 400)
|
||||||
|
->addMarkers(
|
||||||
|
(new Markers(__DIR__ . '/resources/marker.png'))
|
||||||
|
->setAnchor(Markers::ANCHOR_CENTER, Markers::ANCHOR_BOTTOM)
|
||||||
|
->addMarker(new LatLng(44.351933, 2.568113))
|
||||||
|
->addMarker(new LatLng(44.351510, 2.570020))
|
||||||
|
->addMarker(new LatLng(44.351873, 2.566250))
|
||||||
|
)
|
||||||
|
->addDraw(
|
||||||
|
(new Polygon('FF0000', 2, 'FF0000DD'))
|
||||||
|
->addPoint(new LatLng(44.351172, 2.571092))
|
||||||
|
->addPoint(new LatLng(44.352097, 2.570045))
|
||||||
|
->addPoint(new LatLng(44.352665, 2.568107))
|
||||||
|
->addPoint(new LatLng(44.352887, 2.566503))
|
||||||
|
->addPoint(new LatLng(44.352806, 2.565972))
|
||||||
|
->addPoint(new LatLng(44.351517, 2.565672))
|
||||||
|
)
|
||||||
|
->getImage()
|
||||||
|
->displayPNG();
|
||||||
|
|
||||||
|
|
90
vendor/dantsu/php-osm-static-api/src/samples/sample2.php
vendored
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
<?php
|
||||||
|
require_once '../../vendor/autoload.php';
|
||||||
|
|
||||||
|
require_once '../MapData.php';
|
||||||
|
require_once '../LatLng.php';
|
||||||
|
require_once '../Line.php';
|
||||||
|
require_once '../Markers.php';
|
||||||
|
require_once '../OpenStreetMap.php';
|
||||||
|
require_once '../XY.php';
|
||||||
|
|
||||||
|
use \DantSu\OpenStreetMapStaticAPI\OpenStreetMap;
|
||||||
|
use \DantSu\OpenStreetMapStaticAPI\LatLng;
|
||||||
|
use \DantSu\OpenStreetMapStaticAPI\Line;
|
||||||
|
use \DantSu\OpenStreetMapStaticAPI\Markers;
|
||||||
|
|
||||||
|
\header('Content-type: image/png');
|
||||||
|
(new OpenStreetMap(new LatLng(44.351933, 2.568113), 5, 1024, 1024))
|
||||||
|
->addMarkers(
|
||||||
|
(new Markers(__DIR__ . '/resources/marker.png'))
|
||||||
|
->setAnchor(Markers::ANCHOR_CENTER, Markers::ANCHOR_BOTTOM)
|
||||||
|
->addMarker(new LatLng(44.351933, 2.568113))
|
||||||
|
)
|
||||||
|
->addMarkers(
|
||||||
|
(new Markers(__DIR__ . '/resources/marker2.png'))
|
||||||
|
->setAnchor(Markers::ANCHOR_CENTER, Markers::ANCHOR_BOTTOM)
|
||||||
|
->addMarker(new LatLng(48.858535, 2.294107))
|
||||||
|
->addMarker(new LatLng(52.516304, 13.378107))
|
||||||
|
->addMarker(new LatLng(40.415176, -3.707362))
|
||||||
|
->addMarker(new LatLng(51.500845, -0.124591))
|
||||||
|
->addMarker(new LatLng(41.890145, 12.492552))
|
||||||
|
->addMarker(new LatLng(36.809764, 10.134114))
|
||||||
|
->addMarker(new LatLng(31.621758, -7.981512))
|
||||||
|
->addMarker(new LatLng(47.500469, 19.054086))
|
||||||
|
->addMarker(new LatLng(28.119083, -15.438387))
|
||||||
|
->addMarker(new LatLng(57.704334, 11.963886))
|
||||||
|
)
|
||||||
|
->addDraw(
|
||||||
|
(new Line('FF0000', 1))
|
||||||
|
->addPoint(new LatLng(44.351933, 2.568113))
|
||||||
|
->addPoint(new LatLng(48.858535, 2.294107))
|
||||||
|
)
|
||||||
|
->addDraw(
|
||||||
|
(new Line('FF0000', 1))
|
||||||
|
->addPoint(new LatLng(44.351933, 2.568113))
|
||||||
|
->addPoint(new LatLng(52.516304, 13.378107))
|
||||||
|
)
|
||||||
|
->addDraw(
|
||||||
|
(new Line('FF0000', 1))
|
||||||
|
->addPoint(new LatLng(44.351933, 2.568113))
|
||||||
|
->addPoint(new LatLng(40.415176, -3.707362))
|
||||||
|
)
|
||||||
|
->addDraw(
|
||||||
|
(new Line('FF0000', 1))
|
||||||
|
->addPoint(new LatLng(44.351933, 2.568113))
|
||||||
|
->addPoint(new LatLng(51.500845, -0.124591))
|
||||||
|
)
|
||||||
|
->addDraw(
|
||||||
|
(new Line('FF0000', 1))
|
||||||
|
->addPoint(new LatLng(44.351933, 2.568113))
|
||||||
|
->addPoint(new LatLng(41.890145, 12.492552))
|
||||||
|
)
|
||||||
|
->addDraw(
|
||||||
|
(new Line('FF0000', 1))
|
||||||
|
->addPoint(new LatLng(44.351933, 2.568113))
|
||||||
|
->addPoint(new LatLng(36.809764, 10.134114))
|
||||||
|
)
|
||||||
|
->addDraw(
|
||||||
|
(new Line('FF0000', 1))
|
||||||
|
->addPoint(new LatLng(44.351933, 2.568113))
|
||||||
|
->addPoint(new LatLng(31.621758, -7.981512))
|
||||||
|
)
|
||||||
|
->addDraw(
|
||||||
|
(new Line('FF0000', 1))
|
||||||
|
->addPoint(new LatLng(44.351933, 2.568113))
|
||||||
|
->addPoint(new LatLng(47.500469, 19.054086))
|
||||||
|
)
|
||||||
|
->addDraw(
|
||||||
|
(new Line('FF0000', 1))
|
||||||
|
->addPoint(new LatLng(44.351933, 2.568113))
|
||||||
|
->addPoint(new LatLng(28.119083, -15.438387))
|
||||||
|
)
|
||||||
|
->addDraw(
|
||||||
|
(new Line('FF0000', 1))
|
||||||
|
->addPoint(new LatLng(44.351933, 2.568113))
|
||||||
|
->addPoint(new LatLng(57.704334, 11.963886))
|
||||||
|
)
|
||||||
|
->getImage()
|
||||||
|
->displayPNG();
|
||||||
|
|
||||||
|
|
37
vendor/dantsu/php-osm-static-api/src/samples/sample3.php
vendored
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
require_once '../../vendor/autoload.php';
|
||||||
|
|
||||||
|
require_once '../MapData.php';
|
||||||
|
require_once '../LatLng.php';
|
||||||
|
require_once '../Circle.php';
|
||||||
|
require_once '../Markers.php';
|
||||||
|
require_once '../OpenStreetMap.php';
|
||||||
|
require_once '../XY.php';
|
||||||
|
|
||||||
|
use \DantSu\OpenStreetMapStaticAPI\OpenStreetMap;
|
||||||
|
use \DantSu\OpenStreetMapStaticAPI\LatLng;
|
||||||
|
use \DantSu\OpenStreetMapStaticAPI\Circle;
|
||||||
|
use \DantSu\OpenStreetMapStaticAPI\Markers;
|
||||||
|
|
||||||
|
\header('Content-type: image/png');
|
||||||
|
(new OpenStreetMap(new LatLng(0, 0), 0, 600, 400))
|
||||||
|
->addMarkers(
|
||||||
|
(new Markers(__DIR__ . '/resources/marker.png'))
|
||||||
|
->setAnchor(Markers::ANCHOR_CENTER, Markers::ANCHOR_BOTTOM)
|
||||||
|
->addMarker(new LatLng(44.351933, 2.568113))
|
||||||
|
->addMarker(new LatLng(44.351510, 2.570020))
|
||||||
|
->addMarker(new LatLng(44.351073, 2.566480))
|
||||||
|
)
|
||||||
|
->addDraw(
|
||||||
|
(new Circle(new LatLng(44.351933, 2.568113), 'FF0000', 5, 'FF0000CC'))
|
||||||
|
->setEdgePoint(new LatLng(44.351510, 2.570020))
|
||||||
|
)
|
||||||
|
->addDraw(
|
||||||
|
(new Circle(new LatLng(44.351933, 2.568113), 'FF0000', 5, 'FF0000CC'))
|
||||||
|
->setRadius(40)
|
||||||
|
)
|
||||||
|
->fitToDraws(10)
|
||||||
|
->getImage()
|
||||||
|
->displayPNG();
|
||||||
|
|
||||||
|
|
52
vendor/dantsu/php-osm-static-api/src/samples/sample4.php
vendored
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
<?php
|
||||||
|
require_once '../../vendor/autoload.php';
|
||||||
|
|
||||||
|
require_once '../MapData.php';
|
||||||
|
require_once '../LatLng.php';
|
||||||
|
require_once '../Polygon.php';
|
||||||
|
require_once '../Markers.php';
|
||||||
|
require_once '../OpenStreetMap.php';
|
||||||
|
require_once '../TileLayer.php';
|
||||||
|
require_once '../XY.php';
|
||||||
|
|
||||||
|
use \DantSu\OpenStreetMapStaticAPI\OpenStreetMap;
|
||||||
|
use \DantSu\OpenStreetMapStaticAPI\LatLng;
|
||||||
|
use \DantSu\OpenStreetMapStaticAPI\Polygon;
|
||||||
|
use \DantSu\OpenStreetMapStaticAPI\Markers;
|
||||||
|
use \DantSu\OpenStreetMapStaticAPI\TileLayer;
|
||||||
|
|
||||||
|
\header('Content-type: image/png');
|
||||||
|
|
||||||
|
$tileLayer1 = (new TileLayer(
|
||||||
|
'https://khms{s}.google.com/kh/v=925?x={x}&y={y}&z={z}',
|
||||||
|
'Images ©2022 Maxar Technologies',
|
||||||
|
'0123'
|
||||||
|
));
|
||||||
|
|
||||||
|
// https://stackoverflow.com/a/29712049
|
||||||
|
$tileLayer2 = (new TileLayer(
|
||||||
|
'https://mts{s}.google.com/vt/lyrs=h&x={x}&y={y}&z={z}&apistyle=s.t%3A2|p.v%3Aoff',
|
||||||
|
'©GoogleMaps',
|
||||||
|
'0123'
|
||||||
|
))->setOpacity(0.8);
|
||||||
|
|
||||||
|
(new OpenStreetMap(new LatLng(44.351933, 2.568113), 17, 600, 400, $tileLayer1))
|
||||||
|
->addLayer($tileLayer2)
|
||||||
|
->addMarkers(
|
||||||
|
(new Markers(__DIR__ . '/resources/marker.png'))
|
||||||
|
->setAnchor(Markers::ANCHOR_CENTER, Markers::ANCHOR_BOTTOM)
|
||||||
|
->addMarker(new LatLng(44.351933, 2.568113))
|
||||||
|
->addMarker(new LatLng(44.351510, 2.570020))
|
||||||
|
->addMarker(new LatLng(44.351873, 2.566250))
|
||||||
|
)
|
||||||
|
->addDraw(
|
||||||
|
(new Polygon('FF0000', 2, 'FF0000DD'))
|
||||||
|
->addPoint(new LatLng(44.351172, 2.571092))
|
||||||
|
->addPoint(new LatLng(44.352097, 2.570045))
|
||||||
|
->addPoint(new LatLng(44.352665, 2.568107))
|
||||||
|
->addPoint(new LatLng(44.352887, 2.566503))
|
||||||
|
->addPoint(new LatLng(44.352806, 2.565972))
|
||||||
|
->addPoint(new LatLng(44.351517, 2.565672))
|
||||||
|
)
|
||||||
|
->getImage()
|
||||||
|
->displayPNG();
|
9
vendor/discord-php/http/.gitignore
vendored
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
/vendor/
|
||||||
|
composer.lock
|
||||||
|
test.php
|
||||||
|
.php_cs.cache
|
||||||
|
.php_cs
|
||||||
|
.php-cs-fixer.php
|
||||||
|
.php-cs-fixer.cache
|
||||||
|
.vscode
|
||||||
|
.phpunit.cache
|
102
vendor/discord-php/http/.php-cs-fixer.dist.php
vendored
Normal file
@ -0,0 +1,102 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
$header = <<<'EOF'
|
||||||
|
This file is a part of the DiscordPHP-Http project.
|
||||||
|
|
||||||
|
Copyright (c) 2021-present David Cole <david.cole1340@gmail.com>
|
||||||
|
|
||||||
|
This file is subject to the MIT license that is bundled
|
||||||
|
with this source code in the LICENSE file.
|
||||||
|
EOF;
|
||||||
|
|
||||||
|
$fixers = [
|
||||||
|
'blank_line_after_namespace',
|
||||||
|
'braces',
|
||||||
|
'class_definition',
|
||||||
|
'elseif',
|
||||||
|
'encoding',
|
||||||
|
'full_opening_tag',
|
||||||
|
'function_declaration',
|
||||||
|
'lowercase_keywords',
|
||||||
|
'method_argument_space',
|
||||||
|
'no_closing_tag',
|
||||||
|
'no_spaces_after_function_name',
|
||||||
|
'no_spaces_inside_parenthesis',
|
||||||
|
'no_trailing_whitespace',
|
||||||
|
'no_trailing_whitespace_in_comment',
|
||||||
|
'single_blank_line_at_eof',
|
||||||
|
'single_class_element_per_statement',
|
||||||
|
'single_import_per_statement',
|
||||||
|
'single_line_after_imports',
|
||||||
|
'switch_case_semicolon_to_colon',
|
||||||
|
'switch_case_space',
|
||||||
|
'visibility_required',
|
||||||
|
'blank_line_after_opening_tag',
|
||||||
|
'no_multiline_whitespace_around_double_arrow',
|
||||||
|
'no_empty_statement',
|
||||||
|
'include',
|
||||||
|
'no_trailing_comma_in_list_call',
|
||||||
|
'not_operator_with_successor_space',
|
||||||
|
'no_leading_namespace_whitespace',
|
||||||
|
'no_blank_lines_after_class_opening',
|
||||||
|
'no_blank_lines_after_phpdoc',
|
||||||
|
'object_operator_without_whitespace',
|
||||||
|
'binary_operator_spaces',
|
||||||
|
'phpdoc_indent',
|
||||||
|
'general_phpdoc_tag_rename',
|
||||||
|
'phpdoc_inline_tag_normalizer',
|
||||||
|
'phpdoc_tag_type',
|
||||||
|
'phpdoc_no_access',
|
||||||
|
'phpdoc_no_package',
|
||||||
|
'phpdoc_scalar',
|
||||||
|
'phpdoc_summary',
|
||||||
|
'phpdoc_to_comment',
|
||||||
|
'phpdoc_trim',
|
||||||
|
'phpdoc_var_without_name',
|
||||||
|
'no_leading_import_slash',
|
||||||
|
'no_trailing_comma_in_singleline_array',
|
||||||
|
'single_blank_line_before_namespace',
|
||||||
|
'single_quote',
|
||||||
|
'no_singleline_whitespace_before_semicolons',
|
||||||
|
'cast_spaces',
|
||||||
|
'standardize_not_equals',
|
||||||
|
'ternary_operator_spaces',
|
||||||
|
'trim_array_spaces',
|
||||||
|
'unary_operator_spaces',
|
||||||
|
'no_unused_imports',
|
||||||
|
'no_useless_else',
|
||||||
|
'no_useless_return',
|
||||||
|
'phpdoc_no_empty_return',
|
||||||
|
'no_extra_blank_lines',
|
||||||
|
'multiline_whitespace_before_semicolons',
|
||||||
|
];
|
||||||
|
|
||||||
|
$rules = [
|
||||||
|
'concat_space' => ['spacing' => 'none'],
|
||||||
|
'phpdoc_no_alias_tag' => ['replacements' => ['type' => 'var']],
|
||||||
|
'array_syntax' => ['syntax' => 'short'],
|
||||||
|
'binary_operator_spaces' => ['align_double_arrow' => true, 'align_equals' => true],
|
||||||
|
'header_comment' => ['header' => $header],
|
||||||
|
'indentation_type' => true,
|
||||||
|
'phpdoc_align' => [
|
||||||
|
'align' => 'vertical',
|
||||||
|
'tags' => ['param', 'property', 'property-read', 'property-write', 'return', 'throws', 'type', 'var', 'method'],
|
||||||
|
],
|
||||||
|
'blank_line_before_statement' => ['statements' => ['return']],
|
||||||
|
'constant_case' => ['case' => 'lower'],
|
||||||
|
'echo_tag_syntax' => ['format' => 'long'],
|
||||||
|
'trailing_comma_in_multiline' => ['elements' => ['arrays']],
|
||||||
|
];
|
||||||
|
|
||||||
|
foreach ($fixers as $fix) {
|
||||||
|
$rules[$fix] = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
$config = new PhpCsFixer\Config();
|
||||||
|
|
||||||
|
return $config
|
||||||
|
->setRules($rules)
|
||||||
|
->setFinder(
|
||||||
|
PhpCsFixer\Finder::create()
|
||||||
|
->in(__DIR__)
|
||||||
|
);
|
22
vendor/discord-php/http/LICENSE
vendored
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2021-present David Cole <david.cole1340@gmail.com> and all
|
||||||
|
contributors
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
92
vendor/discord-php/http/README.md
vendored
Normal file
@ -0,0 +1,92 @@
|
|||||||
|
# DiscordPHP-Http
|
||||||
|
|
||||||
|
Asynchronous HTTP client used for communication with the Discord REST API.
|
||||||
|
|
||||||
|
## Requirements
|
||||||
|
|
||||||
|
- PHP >=7.4
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$ composer require discord-php/http
|
||||||
|
```
|
||||||
|
|
||||||
|
A [psr/log](https://packagist.org/packages/psr/log)-compliant logging library is also required. We recommend [monolog](https://github.com/Seldaek/monolog) which will be used in examples.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```php
|
||||||
|
<?php
|
||||||
|
|
||||||
|
include 'vendor/autoload.php';
|
||||||
|
|
||||||
|
use Monolog\Logger;
|
||||||
|
use Monolog\Handler\StreamHandler;
|
||||||
|
use Discord\Http\Http;
|
||||||
|
use Discord\Http\Drivers\React;
|
||||||
|
|
||||||
|
$loop = \React\EventLoop\Factory::create();
|
||||||
|
$logger = (new Logger('logger-name'))->pushHandler(new StreamHandler('php://output'));
|
||||||
|
$http = new Http(
|
||||||
|
'Bot xxxx.yyyy.zzzz',
|
||||||
|
$loop,
|
||||||
|
$logger
|
||||||
|
);
|
||||||
|
|
||||||
|
// set up a driver - this example uses the React driver
|
||||||
|
$driver = new React($loop);
|
||||||
|
$http->setDriver($driver);
|
||||||
|
|
||||||
|
// must be the last line
|
||||||
|
$loop->run();
|
||||||
|
```
|
||||||
|
|
||||||
|
All request methods have the same footprint:
|
||||||
|
|
||||||
|
```php
|
||||||
|
$http->get(string $url, $content = null, array $headers = []);
|
||||||
|
$http->post(string $url, $content = null, array $headers = []);
|
||||||
|
$http->put(string $url, $content = null, array $headers = []);
|
||||||
|
$http->patch(string $url, $content = null, array $headers = []);
|
||||||
|
$http->delete(string $url, $content = null, array $headers = []);
|
||||||
|
```
|
||||||
|
|
||||||
|
For other methods:
|
||||||
|
|
||||||
|
```php
|
||||||
|
$http->queueRequest(string $method, string $url, $content, array $headers = []);
|
||||||
|
```
|
||||||
|
|
||||||
|
All methods return the decoded JSON response in an object:
|
||||||
|
|
||||||
|
```php
|
||||||
|
// https://discord.com/api/v8/oauth2/applications/@me
|
||||||
|
$http->get('oauth2/applications/@me')->done(function ($response) {
|
||||||
|
var_dump($response);
|
||||||
|
}, function ($e) {
|
||||||
|
echo "Error: ".$e->getMessage().PHP_EOL;
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
Most Discord endpoints are provided in the [Endpoint.php](src/Discord/Endpoint.php) class as constants. Parameters start with a colon,
|
||||||
|
e.g. `channels/:channel_id/messages/:message_id`. You can bind parameters to then with the same class:
|
||||||
|
|
||||||
|
```php
|
||||||
|
// channels/channel_id_here/messages/message_id_here
|
||||||
|
$endpoint = Endpoint::bind(Endpoint::CHANNEL_MESSAGE, 'channel_id_here', 'message_id_here');
|
||||||
|
|
||||||
|
$http->get($endpoint)->done(...);
|
||||||
|
```
|
||||||
|
|
||||||
|
It is recommended that if the endpoint contains parameters you use the `Endpoint::bind()` function to sort requests into their correct rate limit buckets.
|
||||||
|
For an example, see [DiscordPHP](https://github.com/discord-php/DiscordPHP).
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
This software is licensed under the MIT license which can be viewed in the [LICENSE](LICENSE) file.
|
||||||
|
|
||||||
|
## Credits
|
||||||
|
|
||||||
|
- [David Cole](mailto:david.cole1340@gmail.com)
|
||||||
|
- All contributors
|
43
vendor/discord-php/http/composer.json
vendored
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
{
|
||||||
|
"name": "discord-php/http",
|
||||||
|
"description": "Handles HTTP requests to Discord servers",
|
||||||
|
"type": "library",
|
||||||
|
"license": "MIT",
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "David Cole",
|
||||||
|
"email": "david.cole1340@gmail.com"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Discord\\Http\\": "src/Discord",
|
||||||
|
"Tests\\Discord\\Http\\": "tests/Discord"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": "^7.4|^8.0",
|
||||||
|
"react/http": "^1.2",
|
||||||
|
"psr/log": "^1.1 || ^2.0 || ^3.0",
|
||||||
|
"react/promise": "^2.2 || ^3.0.0"
|
||||||
|
},
|
||||||
|
"suggest": {
|
||||||
|
"guzzlehttp/guzzle": "For alternative to ReactPHP/Http Browser"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"monolog/monolog": "^2.2",
|
||||||
|
"friendsofphp/php-cs-fixer": "^2.17",
|
||||||
|
"psy/psysh": "^0.10.6",
|
||||||
|
"guzzlehttp/guzzle": "^6.0|^7.0",
|
||||||
|
"phpunit/phpunit": "^9.5",
|
||||||
|
"mockery/mockery": "^1.5",
|
||||||
|
"react/async": "^4 || ^3"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"test": "php tests/Drivers/_server.php& HTTP_SERVER_PID=$!; ./vendor/bin/phpunit; kill $HTTP_SERVER_PID;",
|
||||||
|
"test-discord": "./vendor/bin/phpunit --testsuite Discord",
|
||||||
|
"test-drivers": "php tests/Drivers/_server.php& HTTP_SERVER_PID=$!; ./vendor/bin/phpunit --testsuite Drivers; kill $HTTP_SERVER_PID;",
|
||||||
|
"test-coverage": "php tests/Drivers/_server.php& HTTP_SERVER_PID=$!; php -d xdebug.mode=coverage ./vendor/bin/phpunit --coverage-text; kill $HTTP_SERVER_PID;",
|
||||||
|
"test-coverage-html": "php tests/Drivers/_server.php& HTTP_SERVER_PID=$!; php -d xdebug.mode=coverage ./vendor/bin/phpunit --coverage-html .phpunit.cache/cov-html; kill $HTTP_SERVER_PID;"
|
||||||
|
}
|
||||||
|
}
|
57
vendor/discord-php/http/examples/file-upload.php
vendored
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Discord\Http\Drivers\Guzzle;
|
||||||
|
use Discord\Http\Endpoint;
|
||||||
|
use Discord\Http\Http;
|
||||||
|
use Discord\Http\Multipart\MultipartBody;
|
||||||
|
use Discord\Http\Multipart\MultipartField;
|
||||||
|
use Psr\Log\NullLogger;
|
||||||
|
use React\EventLoop\Loop;
|
||||||
|
|
||||||
|
require './vendor/autoload.php';
|
||||||
|
|
||||||
|
$http = new Http(
|
||||||
|
'Your token',
|
||||||
|
Loop::get(),
|
||||||
|
new NullLogger(),
|
||||||
|
new Guzzle(
|
||||||
|
Loop::get()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
$jsonPayloadField = new MultipartField(
|
||||||
|
'json_payload',
|
||||||
|
json_encode([
|
||||||
|
'content' => 'Hello!',
|
||||||
|
]),
|
||||||
|
['Content-Type' => 'application/json']
|
||||||
|
);
|
||||||
|
|
||||||
|
$imageField = new MultipartField(
|
||||||
|
'files[0]',
|
||||||
|
file_get_contents('/path/to/image.png'),
|
||||||
|
['Content-Type' => 'image/png'],
|
||||||
|
'image.png'
|
||||||
|
);
|
||||||
|
|
||||||
|
$multipart = new MultipartBody([
|
||||||
|
$jsonPayloadField,
|
||||||
|
$imageField
|
||||||
|
]);
|
||||||
|
|
||||||
|
$http->post(
|
||||||
|
Endpoint::bind(
|
||||||
|
Endpoint::CHANNEL_MESSAGES,
|
||||||
|
'Channel ID'
|
||||||
|
),
|
||||||
|
$multipart
|
||||||
|
)->then(
|
||||||
|
function ($response) {
|
||||||
|
// Do something with response..
|
||||||
|
},
|
||||||
|
function (Exception $e) {
|
||||||
|
echo $e->getMessage(), PHP_EOL;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
Loop::run();
|