2017 © Pedro Peláez
 

library qualityvalue

Quality Values

image

konfirm/qualityvalue

Quality Values

  • Sunday, January 28, 2018
  • by konfirm
  • Repository
  • 1 Watchers
  • 0 Stars
  • 8 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

Quality Values

Quality Values library for PHP (7+), for the parsing, sorting and filtering of Quality Value strings, such as the HTTP Accept(-Charset,-Encoding and -Language) headers., (*1)

Example use

<?php

use Konfirm\QualityValue\Collection;

$collection = Collection::fromString('foo,qux;q=0,baz;q=0.8,bar;q=1');

//  turn back into a string
$proper = (string) $collection;

//  "foo,bar,baz;q=.8"
//  - sorted on weight (original order if the weight is equal)
//  - 'bar' has its weight (q=) removed as it's 1, which is the default
//  - 'qux' is removed as the weight 0 indicates "not acceptable") 

foreach ($collection as $token) {
    print $token->getValue();  //  'foo' > 'bar' > 'baz'
}

//  obtain the first token 

$first = $collection->rewind();  //  Konfirm\QualityValue\Token
print $first->getValue();   // 'foo'
print $first->getWeight();  //  1


//  ...and the next
$next = $collection->next();  //  Konfirm\QualityValue\Token
print $first->getValue();   // 'bar'
print $first->getWeight();  //  1

//  etc

Features

  • PSR-4 autoloading compliant structure
  • Full code coverage with PHPUnit

The Versions

28/01 2018

dev-master

9999999-dev

Quality Values

  Sources   Download

MIT dbad

The Requires

  • php >=7.0

 

The Development Requires

by Rogier Spieker

quality-values

28/01 2018

1.3.0

1.3.0.0

Quality Values

  Sources   Download

MIT

The Requires

  • php >=7.0

 

The Development Requires

by Rogier Spieker

quality-values

25/06 2017

1.2.0

1.2.0.0

Quality Values

  Sources   Download

dbad

The Requires

 

The Development Requires

by Rogier Spieker

quality-values

24/06 2017

1.1.0

1.1.0.0

Quality Values

  Sources   Download

dbad

The Requires

  • php >=7.0

 

The Development Requires

by Rogier Spieker

quality-values

24/06 2017

1.0.0

1.0.0.0

Quality Values

  Sources   Download

dbad

The Requires

  • php >=7.0

 

The Development Requires

by Rogier Spieker

quality-values