1. Go to this page and download the library: Download ruff3d/boarding library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
ruff3d / boarding example snippets
use BoardingCards\{Boarding, TrainTicket, FlightTicket, BusTicket};
// Add unsorted Tickets to Boarding
$boarding = new Boarding(
new FlightTicket('Stockholm', 'New York JFK', 'SK22','22','7B'),
new FlightTicket('Gerona Airport', 'Stockholm', 'SK455', '45B', '3A', '344'),
new BusTicket('Barcelona', 'Gerona Airport'),
new TrainTicket('Madrid', 'Barcelona', '78A', '45B')
);
// Get ordered Tickets list
$orderedList = $boarding->getReorderedList();
// Render List Items
echo $boarding->renderList();
namespace BoardingCards;
class WalkTicket extends Ticket {
/**
* @var bool
*/
private $alone;
// extending default constructor
public function __construct(string $from, string $to, bool $alone)
{
parent::__construct( $from, $to );
$this->alone = $alone;
}
/**
* @return string
*/
public function render(): string
{
return "I walking " . ( $this->alone ? "alone" : "with my friends" );
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.