Skip to content
This repository has been archived by the owner on Sep 20, 2021. It is now read-only.

Change attributes to constants in Tput to save memory #92

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions Source/Tput.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class Tput
/**
* Booleans.
*/
protected static $_booleans = [
protected const BOOLEANS = [
'auto_left_margin',
'auto_right_margin',
'no_esc_ctlc',
Expand Down Expand Up @@ -102,7 +102,7 @@ class Tput
/**
* Numbers.
*/
protected static $_numbers = [
protected const NUMBERS = [
'columns',
'init_tabs',
'lines',
Expand Down Expand Up @@ -148,7 +148,7 @@ class Tput
/**
* Strings.
*/
protected static $_strings = [
protected const STRINGS = [
'back_tab',
'bell',
'carriage_return',
Expand Down Expand Up @@ -626,7 +626,7 @@ protected function parse(string $terminfo): array
// Booleans.
$i += $headers['names_size'];
$booleans = [];
$booleanNames = &static::$_booleans;
$booleanNames = &self::BOOLEANS;

for (
$e = 0, $max = $i + $headers['bool_count'];
Expand All @@ -644,7 +644,7 @@ protected function parse(string $terminfo): array
}

$numbers = [];
$numberNames = &static::$_numbers;
$numberNames = &self::NUMBERS;

for (
$e = 0, $max = $i + $headers['number_count'] * 2;
Expand All @@ -666,7 +666,7 @@ protected function parse(string $terminfo): array

// Strings.
$strings = [];
$stringNames = &static::$_strings;
$stringNames = &self::STRINGS;
$ii = $i + $headers['string_count'] * 2;

for (
Expand Down