Browse Source

Updated readme

Joachim M. Giæver 4 years ago
parent
commit
584461eeee
1 changed files with 291 additions and 29 deletions
  1. 291 29
      README.md

+ 291 - 29
README.md

@@ -10,16 +10,19 @@ Yr Forecast
 			2. [Tabular](#appyrforecasttabular "App\Yr\Forecast\Tabular")
 				1. [Time](#appyrforecasttabulartime "App\Yr\Forecast\Tabular\Time")
 					1. [AbstractUnit](#abstractunit-appyrforecasttabulartime "App\Yr\Forecast\Tabular\Time\AbstractUnit") Time-object entity should inherit this
-					2. [CustomUnit](#customunit-appyrforecasttabulartime "App\Yr\Forecast\Tabular\Time\CustomUnit")
-					3. [DiffInterface](#diffinterface-appyrforecasttabulartime "App\Yr\Forecast\Tabular\Time\DiffInterface") Defines that an entity can be checked for differencesagains another entity.
-					4. [Pressure](#pressure-appyrforecasttabulartime "App\Yr\Forecast\Tabular\Time\Pressure") Airpressure
-					5. [Symbol](#symbol-appyrforecasttabulartime "App\Yr\Forecast\Tabular\Time\Symbol") Contains the sky data, e.g «Clody» etc
-					6. [Temperature](#temperature-appyrforecasttabulartime "App\Yr\Forecast\Tabular\Time\Temperature") Temperature
-					7. [WindDirection](#winddirection-appyrforecasttabulartime "App\Yr\Forecast\Tabular\Time\WindDirection") Wind direction
-					8. [WindSpeed](#windspeed-appyrforecasttabulartime "App\Yr\Forecast\Tabular\Time\WindSpeed") Wind speed
-				2. [Statistics](#statistics-appyrforecasttabular "App\Yr\Forecast\Tabular\Statistics") Make simple statistic on analysed time objects,such as highest/lowest wind speed and temperature,average wind speed and temperature etc.
-				3. [Time](#time-appyrforecasttabular "App\Yr\Forecast\Tabular\Time") Forecast data witin a time period
-				4. [Variations](#variations-appyrforecasttabular "App\Yr\Forecast\Tabular\Variations") Removes superfluous forecast data in an Time-objectonly storing changes.
+					2. [ConvertableInterface](#convertableinterface-appyrforecasttabulartime "App\Yr\Forecast\Tabular\Time\ConvertableInterface") Implemented on units that can be converted,such as wind speed and temperature.
+					3. [CustomUnit](#customunit-appyrforecasttabulartime "App\Yr\Forecast\Tabular\Time\CustomUnit") Custom unit, only used to operate on units of same kind
+					4. [DiffInterface](#diffinterface-appyrforecasttabulartime "App\Yr\Forecast\Tabular\Time\DiffInterface") Defines that an entity can be checked for differencesagains another entity.
+					5. [Pressure](#pressure-appyrforecasttabulartime "App\Yr\Forecast\Tabular\Time\Pressure") Airpressure
+					6. [Symbol](#symbol-appyrforecasttabulartime "App\Yr\Forecast\Tabular\Time\Symbol") Contains the sky data, e.g «Clody» etc
+					7. [Temperature](#temperature-appyrforecasttabulartime "App\Yr\Forecast\Tabular\Time\Temperature") Temperature
+					8. [WindDirection](#winddirection-appyrforecasttabulartime "App\Yr\Forecast\Tabular\Time\WindDirection") Wind direction
+					9. [WindSpeed](#windspeed-appyrforecasttabulartime "App\Yr\Forecast\Tabular\Time\WindSpeed") Wind speed
+				2. [Variation](#appyrforecasttabularvariation "App\Yr\Forecast\Tabular\Variation")
+					1. [Variation](#variation-appyrforecasttabularvariation "App\Yr\Forecast\Tabular\Variation\Variation")
+				3. [Statistics](#statistics-appyrforecasttabular "App\Yr\Forecast\Tabular\Statistics") Make simple statistic on analysed time objects,such as highest/lowest wind speed and temperature,average wind speed and temperature etc.
+				4. [Time](#time-appyrforecasttabular "App\Yr\Forecast\Tabular\Time") Forecast data witin a time period
+				5. [Variations](#variations-appyrforecasttabular "App\Yr\Forecast\Tabular\Variations") Removes superfluous forecast data in an Time-objectonly storing changes.
 			3. [Tabular](#tabular-appyrforecast "App\Yr\Forecast\Tabular") Holds the forecast data in Time-objects.
 		2. [Forecast](#forecast-appyr "App\Yr\Forecast") Read forecast data from Yr.no for a specific location.
 
@@ -34,6 +37,7 @@ Documentation
  * [App\Yr\Forecast](#appyrforecast "Namespace: App\Yr\Forecast")
  * [App\Yr\Forecast\Tabular](#appyrforecasttabular "Namespace: App\Yr\Forecast\Tabular")
  * [App\Yr\Forecast\Tabular\Time](#appyrforecasttabulartime "Namespace: App\Yr\Forecast\Tabular\Time")
+ * [App\Yr\Forecast\Tabular\Variation](#appyrforecasttabularvariation "Namespace: App\Yr\Forecast\Tabular\Variation")
 
 # App\Yr
 
@@ -49,6 +53,20 @@ Read forecast data from Yr.no for a specific location.
 Disclaimer: To use this package you are required
 to print the credits from the method ```getCredit()```
 
+Require the package to your project by adding (or creating)
+the following in the `composer.json`-file:
+```
+{
+     "require": {
+         "joachimmg/yr-forecast": "dev-master"
+     },
+     "repositories": [{
+         "type": "vcs",
+         "url": "https://git.giaever.org/joachimmg/yr-forecast.git"
+     }]
+}
+```
+
 #### Methods
 
 |Name|Return|Access|Description|
@@ -298,8 +316,11 @@ repetitive forecast data.
 |[__construct](#__construct-appyrforecasttabular)||public| |
 |[addTime](#addtime-appyrforecasttabular)|[Tabular](#tabular-appyrforecast)|protected| Add a Time-object to the tabular|
 |[getStatistics](#getstatistics-appyrforecasttabular)|[Statistics](#statistics-appyrforecasttabular)|public| Get statistics for the Time-object collection|
+|[makeVariations](#makevariations-appyrforecasttabular)|[Tabular](#tabular-appyrforecast)|protected| |
 |[getVariations](#getvariations-appyrforecasttabular)|[Variations](#variations-appyrforecasttabular)|public| Remove superfluous weather data.|
 |[getBetween](#getbetween-appyrforecasttabular)|[Tabular](#tabular-appyrforecast)|public| Filter data between a certain periode, e.g```$forcast->between( $forcast->getSunset(), $forecast->getSunrise()->add(     new \DateInterval('P1D') ));```to only show from sunset today unti sunrise tomorrow|
+|[getFrom](#getfrom-appyrforecasttabular)|[ateTimeInterface](https://www.google.no/search?q=DateTimeInterface)|public| Return the time this tabular is from|
+|[getUntil](#getuntil-appyrforecasttabular)|[ateTimeInterface](https://www.google.no/search?q=DateTimeInterface)|public| Return the time this tabular is until|
 |[getIterator](#getiterator-appyrforecasttabular)|[enerator](https://www.google.no/search?q=Generator)|public| {@inheritDoc}|
 
 #### Method details
@@ -347,6 +368,16 @@ Returns: [Statistics](#statistics-appyrforecasttabular)
 ---
 
 
+##### makeVariations `App\Yr\Forecast\Tabular`
+```php
+protected function makeVariations();
+```
+
+Returns: [Tabular](#tabular-appyrforecast)
+
+---
+
+
 ##### getVariations `App\Yr\Forecast\Tabular`
 ```php
 public function getVariations();
@@ -390,6 +421,30 @@ Returns: [Tabular](#tabular-appyrforecast)
 ---
 
 
+##### getFrom `App\Yr\Forecast\Tabular`
+```php
+public function getFrom();
+```
+ Return the time this tabular is from
+
+
+Returns: [ateTimeInterface](https://www.google.no/search?q=DateTimeInterface)
+
+---
+
+
+##### getUntil `App\Yr\Forecast\Tabular`
+```php
+public function getUntil();
+```
+ Return the time this tabular is until
+
+
+Returns: [ateTimeInterface](https://www.google.no/search?q=DateTimeInterface)
+
+---
+
+
 ##### getIterator `App\Yr\Forecast\Tabular`
 ```php
 public function getIterator();
@@ -701,6 +756,7 @@ only storing changes.
 |Name|Return|Access|Description|
 |:---|:---|:---|:---|
 |[__construct](#__construct-appyrforecasttabularvariations)||public| |
+|[getTime](#gettime-appyrforecasttabularvariations)|[Time](#time-appyrforecasttabular)|public| |
 |[getData](#getdata-appyrforecasttabularvariations)|array|public| Returns the changes in the forecast|
 
 #### Method details
@@ -718,6 +774,16 @@ Parameters
 ---
 
 
+##### getTime `App\Yr\Forecast\Tabular\Variations`
+```php
+public function getTime();
+```
+
+Returns: [Time](#time-appyrforecasttabular)
+
+---
+
+
 ##### getData `App\Yr\Forecast\Tabular\Variations`
 ```php
 public function getData(callable $filterFn = null);
@@ -752,14 +818,14 @@ Time-object entity should inherit this
 |Name|Return|Access|Description|
 |:---|:---|:---|:---|
 |[__construct](#__construct-appyrforecasttabulartimeabstractunit)||public| |
-|[transformClass](#transformclass-appyrforecasttabulartimeabstractunit)|[AbstractUnit](#abstractunit-appyrforecasttabulartime)|protected| |
+|[transformClass](#transformclass-appyrforecasttabulartimeabstractunit)|[AbstractUnit](#abstractunit-appyrforecasttabulartime)|protected| Transform custom unit to self|
 |[add](#add-appyrforecasttabulartimeabstractunit)|[AbstractUnit](#abstractunit-appyrforecasttabulartime)|public| Addition method|
 |[sub](#sub-appyrforecasttabulartimeabstractunit)|[AbstractUnit](#abstractunit-appyrforecasttabulartime)|public| Subtraction method|
 |[mul](#mul-appyrforecasttabulartimeabstractunit)|[AbstractUnit](#abstractunit-appyrforecasttabulartime)|public| Multiplication method|
 |[div](#div-appyrforecasttabulartimeabstractunit)|[AbstractUnit](#abstractunit-appyrforecasttabulartime)|public| Divide method|
 |[getValue](#getvalue-appyrforecasttabulartimeabstractunit)|float|public| Get the value|
 |[getUnit](#getunit-appyrforecasttabulartimeabstractunit)|string|public| Return the unit (e.g «degree»)|
-|[diff](#diff-appyrforecasttabulartimeabstractunit)|int|public| Check for differences with another DiffInterface.|
+|[diff](#diff-appyrforecasttabulartimeabstractunit)|int|public| Note! Working on floats, so operates on 100-times value.|
 |[__toString](#__tostring-appyrforecasttabulartimeabstractunit)|string|public| |
 
 #### Method details
@@ -782,6 +848,8 @@ Parameters
 ```php
 protected function transformClass(CustomUnit $cu);
 ```
+ Transform custom unit to self
+
 
 Parameters
 
@@ -894,9 +962,9 @@ Returns: string
 ```php
 public function diff(DiffInterface $d);
 ```
- Check for differences with another DiffInterface.
+ Note! Working on floats, so operates on 100-times value.
 
-The method should check that the objects is the same.
+{@inheritDoc}
 
 
 Parameters
@@ -926,6 +994,11 @@ Returns: string
 * Class extends [App\Yr\Forecast\Tabular\Time\AbstractUnit](#abstractunit-appyrforecasttabulartime)
 * Class implements[App\Yr\Forecast\Tabular\Time\DiffInterface](#diffinterface-appyrforecasttabulartime)
 
+Custom unit, only used to operate on units of same kind
+
+Classes should transform this (see {@AbstractUnit}) to
+the correct class again after operation.
+
 
 ### Pressure `App\Yr\Forecast\Tabular\Time`
 
@@ -942,7 +1015,7 @@ Airpressure
 |[__construct](#__construct-appyrforecasttabulartimepressure)||public| |
 |[isLowPressure](#islowpressure-appyrforecasttabulartimepressure)|bool|public| Check if the pressure is below normal pressure|
 |[isHighPressure](#ishighpressure-appyrforecasttabulartimepressure)|bool|public| Check if the pressure is above normal pressure|
-|[diff](#diff-appyrforecasttabulartimepressure)|int|public| Check for differences with another DiffInterface.|
+|[diff](#diff-appyrforecasttabulartimepressure)|int|public| Note! Working on floats, so operates on 100-times value.|
 
 #### Method details
 
@@ -987,9 +1060,9 @@ Returns: bool
 ```php
 public function diff(DiffInterface $d);
 ```
- Check for differences with another DiffInterface.
+ Note! Working on floats, so operates on 100-times value.
 
-The method should check that the objects is the same.
+{@inheritDoc}
 
 
 Parameters
@@ -1106,7 +1179,9 @@ Returns: string
 
 
 * Class extends [App\Yr\Forecast\Tabular\Time\AbstractUnit](#abstractunit-appyrforecasttabulartime)
-* Class implements[App\Yr\Forecast\Tabular\Time\DiffInterface](#diffinterface-appyrforecasttabulartime)
+* Class implements
+	* [App\Yr\Forecast\Tabular\Time\ConvertableInterface](#convertableinterface-appyrforecasttabulartime)
+	* [App\Yr\Forecast\Tabular\Time\DiffInterface](#diffinterface-appyrforecasttabulartime)
 
 Temperature
 
@@ -1115,6 +1190,8 @@ Temperature
 |Name|Return|Access|Description|
 |:---|:---|:---|:---|
 |[__construct](#__construct-appyrforecasttabulartimetemperature)||public| |
+|[convertTo](#convertto-appyrforecasttabulartimetemperature)|[ConvertableInterface](#convertableinterface-appyrforecasttabulartime)|public| Convert the to a different unit|
+|[getDegree](#getdegree-appyrforecasttabulartimetemperature)|string|public| Return the ⁰X symbol|
 
 #### Method details
 
@@ -1131,6 +1208,36 @@ Parameters
 ---
 
 
+##### convertTo `App\Yr\Forecast\Tabular\Time\Temperature`
+```php
+public function convertTo(string $unit);
+```
+ Convert the to a different unit
+
+
+Parameters
+
+| Type | Variable | Description |
+|---|---|---|
+|string|$unit|The unit to convert to, eg UNIT_FTS|
+
+Returns: [ConvertableInterface](#convertableinterface-appyrforecasttabulartime)
+
+---
+
+
+##### getDegree `App\Yr\Forecast\Tabular\Time\Temperature`
+```php
+public function getDegree();
+```
+ Return the ⁰X symbol
+
+
+Returns: string
+
+---
+
+
 ### WindDirection `App\Yr\Forecast\Tabular\Time`
 
 
@@ -1145,7 +1252,8 @@ Wind direction
 |:---|:---|:---|:---|
 |[__construct](#__construct-appyrforecasttabulartimewinddirection)||public| |
 |[getName](#getname-appyrforecasttabulartimewinddirection)|string|public| Returns the wind direction in full,e.g «Northeast».|
-|[diff](#diff-appyrforecasttabulartimewinddirection)|int|public| Check for differences with another DiffInterface.|
+|[getDirection](#getdirection-appyrforecasttabulartimewinddirection)|int|public| Returns a direction on the compass, notin degree, but in interger between 1 - 16,each explining which spectre.|
+|[diff](#diff-appyrforecasttabulartimewinddirection)|int|public| Note! Working on floats, so operates on 100-times value.|
 
 #### Method details
 
@@ -1175,13 +1283,35 @@ Returns: string
 ---
 
 
+##### getDirection `App\Yr\Forecast\Tabular\Time\WindDirection`
+```php
+public function getDirection();
+```
+ Returns a direction on the compass, not
+in degree, but in interger between 1 - 16,
+each explining which spectre.
+
+E.g
+ 1: North,
+ 2: North-northeast,
+ 3: North-east,
+ [...]
+ 9: South
+etc..
+
+
+Returns: int
+
+---
+
+
 ##### diff `App\Yr\Forecast\Tabular\Time\WindDirection`
 ```php
 public function diff(DiffInterface $d);
 ```
- Check for differences with another DiffInterface.
+ Note! Working on floats, so operates on 100-times value.
 
-The method should check that the objects is the same.
+{@inheritDoc}
 
 
 Parameters
@@ -1199,7 +1329,9 @@ Returns: int
 
 
 * Class extends [App\Yr\Forecast\Tabular\Time\AbstractUnit](#abstractunit-appyrforecasttabulartime)
-* Class implements[App\Yr\Forecast\Tabular\Time\DiffInterface](#diffinterface-appyrforecasttabulartime)
+* Class implements
+	* [App\Yr\Forecast\Tabular\Time\ConvertableInterface](#convertableinterface-appyrforecasttabulartime)
+	* [App\Yr\Forecast\Tabular\Time\DiffInterface](#diffinterface-appyrforecasttabulartime)
 
 Wind speed
 
@@ -1208,10 +1340,10 @@ Wind speed
 |Name|Return|Access|Description|
 |:---|:---|:---|:---|
 |[__construct](#__construct-appyrforecasttabulartimewindspeed)||public| |
-|[convertTo](#convertto-appyrforecasttabulartimewindspeed)|[WindSpeed](#windspeed-appyrforecasttabulartime)|public| Convert the wind speed to a different unit|
+|[convertTo](#convertto-appyrforecasttabulartimewindspeed)|[ConvertableInterface](#convertableinterface-appyrforecasttabulartime)|public| Convert the to a different unit|
 |[getName](#getname-appyrforecasttabulartimewindspeed)|string|public| Returns the wind name, e.g «light breeze»|
-|[setName](#setname-appyrforecasttabulartimewindspeed)|[WindSpeed](#windspeed-appyrforecasttabulartime)|protected| |
-|[diff](#diff-appyrforecasttabulartimewindspeed)|int|public| Check for differences with another DiffInterface.|
+|[setName](#setname-appyrforecasttabulartimewindspeed)|[WindSpeed](#windspeed-appyrforecasttabulartime)|protected| Used on conversion|
+|[diff](#diff-appyrforecasttabulartimewindspeed)|int|public| Note! Working on floats, so operates on 100-times value.|
 |[__toString](#__tostring-appyrforecasttabulartimewindspeed)|string|public| |
 
 #### Method details
@@ -1233,7 +1365,7 @@ Parameters
 ```php
 public function convertTo(string $unit);
 ```
- Convert the wind speed to a different unit
+ Convert the to a different unit
 
 
 Parameters
@@ -1242,7 +1374,7 @@ Parameters
 |---|---|---|
 |string|$unit|The unit to convert to, eg UNIT_FTS|
 
-Returns: [WindSpeed](#windspeed-appyrforecasttabulartime)
+Returns: [ConvertableInterface](#convertableinterface-appyrforecasttabulartime)
 
 ---
 
@@ -1263,6 +1395,8 @@ Returns: string
 ```php
 protected function setName(string $name);
 ```
+ Used on conversion
+
 
 Parameters
 
@@ -1279,9 +1413,9 @@ Returns: [WindSpeed](#windspeed-appyrforecasttabulartime)
 ```php
 public function diff(DiffInterface $e);
 ```
- Check for differences with another DiffInterface.
+ Note! Working on floats, so operates on 100-times value.
 
-The method should check that the objects is the same.
+{@inheritDoc}
 
 
 Parameters
@@ -1306,6 +1440,37 @@ Returns: string
 
 ## Interfaces
 
+### ConvertableInterface `App\Yr\Forecast\Tabular\Time`
+
+Implemented on units that can be converted,
+such as wind speed and temperature.
+
+#### Methods
+
+|Name|Return|Access|Description|
+|:---|:---|:---|:---|
+|[convertTo](#convertto-appyrforecasttabulartimeconvertableinterface)|[ConvertableInterface](#convertableinterface-appyrforecasttabulartime)|public| Convert the to a different unit|
+
+#### Method details
+
+##### convertTo `App\Yr\Forecast\Tabular\Time\ConvertableInterface`
+```php
+public function convertTo(string $unit);
+```
+ Convert the to a different unit
+
+
+Parameters
+
+| Type | Variable | Description |
+|---|---|---|
+|string|$unit|The unit to convert to, eg UNIT_FTS|
+
+Returns: [ConvertableInterface](#convertableinterface-appyrforecasttabulartime)
+
+---
+
+
 ### DiffInterface `App\Yr\Forecast\Tabular\Time`
 
 Defines that an entity can be checked for differences
@@ -1336,6 +1501,103 @@ Parameters
 
 Returns: int
 
+---
+
+# App\Yr\Forecast\Tabular\Variation
+
+## Classes
+
+### Variation `App\Yr\Forecast\Tabular\Variation`
+
+
+* Class implements[IteratorAggregate](https://www.google.no/search?q=IteratorAggregate)
+
+#### Methods
+
+|Name|Return|Access|Description|
+|:---|:---|:---|:---|
+|[__construct](#__construct-appyrforecasttabularvariationvariation)||public| |
+|[addEntity](#addentity-appyrforecasttabularvariationvariation)|[Variation](#variation-appyrforecasttabularvariation)|public| |
+|[getTime](#gettime-appyrforecasttabularvariationvariation)|[Time](#time-appyrforecasttabular)|public| |
+|[getIntersection](#getintersection-appyrforecasttabularvariationvariation)|[DiffInterface](#diffinterface-appyrforecasttabularvariationappyrforecasttabulartime) ***v*** null|public| |
+|[isEmpty](#isempty-appyrforecasttabularvariationvariation)|bool|public| |
+|[getIterator](#getiterator-appyrforecasttabularvariationvariation)|[enerator](https://www.google.no/search?q=Generator)|public| |
+
+#### Method details
+
+##### __construct `App\Yr\Forecast\Tabular\Variation\Variation`
+```php
+public function __construct(Time $t);
+```
+
+Parameters
+
+| Type | Variable | Description |
+|---|---|---|
+|[Time](#tabular-appyrforecast)|$t|*None*|
+---
+
+
+##### addEntity `App\Yr\Forecast\Tabular\Variation\Variation`
+```php
+public function addEntity(DiffInterface $entity, DiffInterface null $intersects);
+```
+
+Parameters
+
+| Type | Variable | Description |
+|---|---|---|
+|[DiffInterface](#time-appyrforecasttabular)|$entity|*None*|
+|[DiffInterface](#time-appyrforecasttabular) null|$intersects|*None*|
+
+Returns: [Variation](#variation-appyrforecasttabularvariation)
+
+---
+
+
+##### getTime `App\Yr\Forecast\Tabular\Variation\Variation`
+```php
+public function getTime();
+```
+
+Returns: [Time](#time-appyrforecasttabular)
+
+---
+
+
+##### getIntersection `App\Yr\Forecast\Tabular\Variation\Variation`
+```php
+public function getIntersection(DiffInterface $entity);
+```
+
+Parameters
+
+| Type | Variable | Description |
+|---|---|---|
+|[DiffInterface](#time-appyrforecasttabular)|$entity|*None*|
+
+Returns: [DiffInterface](#diffinterface-appyrforecasttabularvariationappyrforecasttabulartime) ***v*** null
+
+---
+
+
+##### isEmpty `App\Yr\Forecast\Tabular\Variation\Variation`
+```php
+public function isEmpty();
+```
+
+Returns: bool
+
+---
+
+
+##### getIterator `App\Yr\Forecast\Tabular\Variation\Variation`
+```php
+public function getIterator();
+```
+
+Returns: [enerator](https://www.google.no/search?q=Generator)
+
 ---