2017 © Pedro Peláez
 

library boarding

Sort boarding cards and layout list

image

ruff3d/boarding

Sort boarding cards and layout list

  • Sunday, April 29, 2018
  • by ruff3d
  • Repository
  • 0 Watchers
  • 0 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

boarding

Installation

composer install

Run tests

composer run-script test

Using

composer require ruff3d/boarding
<?php

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();

Extending

If you want add new ticket type than just extend abstract class Ticket, (*1)

<?php

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" );
 }
}

The Versions

29/04 2018

dev-master

9999999-dev

Sort boarding cards and layout list

  Sources   Download

MIT

The Requires

  • php >=7.1

 

The Development Requires

29/04 2018

1

1.0.0.0

Sort boarding cards and layout list

  Sources   Download

MIT

The Requires

  • php >=7.1

 

The Development Requires