Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelkeiluweit committed Jun 14, 2020
0 parents commit 57280c7
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 0 deletions.
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# random-integer-number
Example component for OXID eShop 6.2 Services

### Install as package
`composer require michaelkeiluweit/random-integer-number`

### Example usage
```php
<?php

use OxidEsales\EshopCommunity\Internal\Container\ContainerFactory;
use MichaelKeiluweit\RandomIntegerNumber\RandomIntegerNumberInterface;

require_once 'bootstrap.php';

/** @var RandomIntegerNumberInterface $randomIntegerNumber */
$randomIntegerNumber = ContainerFactory::getInstance()->getContainer()->get(RandomIntegerNumberInterface::class);

echo 'random_number: ' . $randomIntegerNumber->shuffle();
echo PHP_EOL;

```
18 changes: 18 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "michaelkeiluweit/random-integer-number",
"type": "oxideshop-component",
"require": {
"php": ">=7.4",
"oxid-esales/oxideshop-metapackage-ce": "^v6.2.0"
},
"autoload": {
"psr-4": {
"MichaelKeiluweit\\RandomIntegerNumber\\": "src/"
}
},
"extra": {
"branch-alias": {
"dev-master": "1.x-dev"
}
}
}
5 changes: 5 additions & 0 deletions services.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
services:
MichaelKeiluweit\RandomIntegerNumber\RandomIntegerNumberInterface:
class: MichaelKeiluweit\RandomIntegerNumber\RandomIntegerNumber
autowire: true
public: true
13 changes: 13 additions & 0 deletions src/RandomIntegerNumber.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php


namespace MichaelKeiluweit\RandomIntegerNumber;


class RandomIntegerNumber implements RandomIntegerNumberInterface
{
public function shuffle(): int
{
return rand(0, PHP_INT_MAX);
}
}
10 changes: 10 additions & 0 deletions src/RandomIntegerNumberInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php


namespace MichaelKeiluweit\RandomIntegerNumber;


interface RandomIntegerNumberInterface
{
public function shuffle(): int;
}

0 comments on commit 57280c7

Please sign in to comment.