PHP Classes

Vehicle Simulator: Simulate the functions of different vehicle types

Recommend this page to a friend!
  Info   View files Example   View files View files (4)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 276 All time: 7,643 This week: 105Up
Version License PHP version Categories
vehicle-simulator 1.0.0Free for non-comm...5.4PHP 5, Emulators
Description 

Author

This package can simulate the functions of different vehicle types.

It provides a generic vehicle class that provides functions like drive, travel, arrived, pick, etc..

Other functionality can be added to a vehicle object that using component objects of decorator classes. Calls to new functions are delegated to the decorator objects.

The package provides component classes to add an engine and wheels to the vehicle.

Innovation Award
PHP Programming Innovation award nominee
June 2016
Number 4


Prize: One downloadable copy of PhpED Professional
Simulators are useful to reproduce real world situations using computational models.

This package can simulate several types of vehicles and their functionality and states, like driving, traveling, arrived, picking, wheels, engines, etc..

Manuel Lemos
Picture of Chi H.
  Performance   Level  
Name: Chi H. <contact>
Classes: 28 packages by
Country: France France
Age: 39
All time rank: 34222 in France France
Week rank: 45 Up3 in France France Up
Innovation award
Innovation award
Nominee: 22x

Winner: 3x

Example

<?php
/*
* Copyright (c) 2014 Chi Hoang
* All rights reserved
*/
require_once("vehicle.php");

$car=new Vehicle\Vehicle("car");
$car=new Vehicle\AddEngine($car,true);
$car=new Vehicle\AddWheels($car,"4");
echo
$car->travel(new Vehicle\Subject("Drive"));
echo
$car->travel(new Vehicle\Subject("Arrived"));
echo
$car->travel(new Vehicle\Subject());
$test=new Vehicle\Subject();

$bicycle=new Vehicle\Vehicle("bicycle");
$bicycle=new Vehicle\AddWheels($bicycle,"2");
echo
$bicycle->travel(new Vehicle\Subject("Drive"));
echo
$bicycle->travel(new Vehicle\Subject("Arrived"));
echo
$bicycle->travel(new Vehicle\Subject());

$motocycle=new Vehicle\Vehicle("motocycle");
$motocycle=new Vehicle\AddWheels($motocycle,"2");
$motocycle=new Vehicle\AddEngine($motocycle,true);
echo
$motocycle->travel(new Vehicle\Subject("Drive"));
echo
$motocycle->travel(new Vehicle\Subject("Arrived"));
echo
$motocycle->travel(new Vehicle\Subject());
?>


  Files folder image Files  
File Role Description
Accessible without login Plain text file example.php Example example
Accessible without login Plain text file TestPrint.txt Output Unit-test output
Plain text file vehicle.php Class vehicle
Accessible without login Plain text file vehicleTest.php Test Unit-test

 Version Control Unique User Downloads Download Rankings  
 0%
Total:276
This week:0
All time:7,643
This week:105Up