embedded-php/core

View on GitHub
src/Gpio/PhpGpioExt.php

Summary

Maintainability
D
1 day
Test Coverage

Showing 6 of 6 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

public function timeInHigh(int $pin, int $timeout): int {
$pinNumber = $this->pinMap($pin);
if (isset($this->inputPins[$pinNumber]) === false) {
throw new RuntimeException(
sprintf(
Severity: Major
Found in src/Gpio/PhpGpioExt.php and 1 other location - About 3 hrs to fix
src/Gpio/PhpGpioExt.php on lines 273..295

Similar blocks of code found in 2 locations. Consider refactoring.
Open

public function timeInLow(int $pin, int $timeout): int {
$pinNumber = $this->pinMap($pin);
if (isset($this->inputPins[$pinNumber]) === false) {
throw new RuntimeException(
sprintf(
Severity: Major
Found in src/Gpio/PhpGpioExt.php and 1 other location - About 3 hrs to fix
src/Gpio/PhpGpioExt.php on lines 249..271

Similar blocks of code found in 2 locations. Consider refactoring.
Open

public function setInputMode(int $pin): void {
$pinNumber = $this->pinMap($pin);
if (isset($this->outputPins[$pinNumber]) === true) {
unset($this->outputPins[$pinNumber]);
}
Severity: Major
Found in src/Gpio/PhpGpioExt.php and 1 other location - About 2 hrs to fix
src/Gpio/PhpGpioExt.php on lines 132..152

Similar blocks of code found in 2 locations. Consider refactoring.
Open

public function setOutputMode(int $pin): void {
$pinNumber = $this->pinMap($pin);
if (isset($this->inputPins[$pinNumber]) === true) {
unset($this->inputPins[$pinNumber]);
}
Severity: Major
Found in src/Gpio/PhpGpioExt.php and 1 other location - About 2 hrs to fix
src/Gpio/PhpGpioExt.php on lines 110..130

Similar blocks of code found in 2 locations. Consider refactoring.
Open

public function waitForRising(int $pin, int $timeout): bool {
$pinNumber = $this->pinMap($pin);
if (isset($this->inputPins[$pinNumber]) === false) {
throw new RuntimeException(
sprintf(
Severity: Minor
Found in src/Gpio/PhpGpioExt.php and 1 other location - About 40 mins to fix
src/Gpio/PhpGpioExt.php on lines 221..233

Similar blocks of code found in 2 locations. Consider refactoring.
Open

public function waitForFalling(int $pin, int $timeout): bool {
$pinNumber = $this->pinMap($pin);
if (isset($this->inputPins[$pinNumber]) === false) {
throw new RuntimeException(
sprintf(
Severity: Minor
Found in src/Gpio/PhpGpioExt.php and 1 other location - About 40 mins to fix
src/Gpio/PhpGpioExt.php on lines 235..247
Category
Status