annotate src/Replacer.php @ 3:6468684362c2

It works! Created a controller, no update insert but it works
author luka
date Tue, 27 Jun 2023 15:32:47 -0400
parents cf9993c5c7df
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
ca36acd2bef2 Have a base going, there is definitly a lot wrong with some of the files and the general structure but overall, it's a starting point
luka
parents:
diff changeset
1 <?php
ca36acd2bef2 Have a base going, there is definitly a lot wrong with some of the files and the general structure but overall, it's a starting point
luka
parents:
diff changeset
2
ca36acd2bef2 Have a base going, there is definitly a lot wrong with some of the files and the general structure but overall, it's a starting point
luka
parents:
diff changeset
3 namespace Wizzard\MagicForger;
ca36acd2bef2 Have a base going, there is definitly a lot wrong with some of the files and the general structure but overall, it's a starting point
luka
parents:
diff changeset
4
ca36acd2bef2 Have a base going, there is definitly a lot wrong with some of the files and the general structure but overall, it's a starting point
luka
parents:
diff changeset
5 use Illuminate\Support\Str;
ca36acd2bef2 Have a base going, there is definitly a lot wrong with some of the files and the general structure but overall, it's a starting point
luka
parents:
diff changeset
6
2
cf9993c5c7df Updated .vimrc for some helper commands.
luka
parents: 1
diff changeset
7 class Replacer
cf9993c5c7df Updated .vimrc for some helper commands.
luka
parents: 1
diff changeset
8 {
1
ca36acd2bef2 Have a base going, there is definitly a lot wrong with some of the files and the general structure but overall, it's a starting point
luka
parents:
diff changeset
9 /**
ca36acd2bef2 Have a base going, there is definitly a lot wrong with some of the files and the general structure but overall, it's a starting point
luka
parents:
diff changeset
10 * Cached replacements for re-use.
ca36acd2bef2 Have a base going, there is definitly a lot wrong with some of the files and the general structure but overall, it's a starting point
luka
parents:
diff changeset
11 *
ca36acd2bef2 Have a base going, there is definitly a lot wrong with some of the files and the general structure but overall, it's a starting point
luka
parents:
diff changeset
12 * @var array
ca36acd2bef2 Have a base going, there is definitly a lot wrong with some of the files and the general structure but overall, it's a starting point
luka
parents:
diff changeset
13 */
2
cf9993c5c7df Updated .vimrc for some helper commands.
luka
parents: 1
diff changeset
14 protected $replacement_cache = [];
cf9993c5c7df Updated .vimrc for some helper commands.
luka
parents: 1
diff changeset
15
1
ca36acd2bef2 Have a base going, there is definitly a lot wrong with some of the files and the general structure but overall, it's a starting point
luka
parents:
diff changeset
16
ca36acd2bef2 Have a base going, there is definitly a lot wrong with some of the files and the general structure but overall, it's a starting point
luka
parents:
diff changeset
17
ca36acd2bef2 Have a base going, there is definitly a lot wrong with some of the files and the general structure but overall, it's a starting point
luka
parents:
diff changeset
18
ca36acd2bef2 Have a base going, there is definitly a lot wrong with some of the files and the general structure but overall, it's a starting point
luka
parents:
diff changeset
19 /**
2
cf9993c5c7df Updated .vimrc for some helper commands.
luka
parents: 1
diff changeset
20 * The lowest level to show log outputs.
1
ca36acd2bef2 Have a base going, there is definitly a lot wrong with some of the files and the general structure but overall, it's a starting point
luka
parents:
diff changeset
21 *
ca36acd2bef2 Have a base going, there is definitly a lot wrong with some of the files and the general structure but overall, it's a starting point
luka
parents:
diff changeset
22 * @var int
ca36acd2bef2 Have a base going, there is definitly a lot wrong with some of the files and the general structure but overall, it's a starting point
luka
parents:
diff changeset
23 */
2
cf9993c5c7df Updated .vimrc for some helper commands.
luka
parents: 1
diff changeset
24 private $log_level = 1;
1
ca36acd2bef2 Have a base going, there is definitly a lot wrong with some of the files and the general structure but overall, it's a starting point
luka
parents:
diff changeset
25
ca36acd2bef2 Have a base going, there is definitly a lot wrong with some of the files and the general structure but overall, it's a starting point
luka
parents:
diff changeset
26
2
cf9993c5c7df Updated .vimrc for some helper commands.
luka
parents: 1
diff changeset
27 public function __construct()
cf9993c5c7df Updated .vimrc for some helper commands.
luka
parents: 1
diff changeset
28 {
cf9993c5c7df Updated .vimrc for some helper commands.
luka
parents: 1
diff changeset
29 /* parent::__construct(); */
cf9993c5c7df Updated .vimrc for some helper commands.
luka
parents: 1
diff changeset
30 }
1
ca36acd2bef2 Have a base going, there is definitly a lot wrong with some of the files and the general structure but overall, it's a starting point
luka
parents:
diff changeset
31
ca36acd2bef2 Have a base going, there is definitly a lot wrong with some of the files and the general structure but overall, it's a starting point
luka
parents:
diff changeset
32
2
cf9993c5c7df Updated .vimrc for some helper commands.
luka
parents: 1
diff changeset
33 /**
cf9993c5c7df Updated .vimrc for some helper commands.
luka
parents: 1
diff changeset
34 * Outputs a log for the replacements based on log level.
cf9993c5c7df Updated .vimrc for some helper commands.
luka
parents: 1
diff changeset
35 */
cf9993c5c7df Updated .vimrc for some helper commands.
luka
parents: 1
diff changeset
36 public function log(string $str, int $log_level = 1): void
cf9993c5c7df Updated .vimrc for some helper commands.
luka
parents: 1
diff changeset
37 {
1
ca36acd2bef2 Have a base going, there is definitly a lot wrong with some of the files and the general structure but overall, it's a starting point
luka
parents:
diff changeset
38
2
cf9993c5c7df Updated .vimrc for some helper commands.
luka
parents: 1
diff changeset
39 if($this->log_level <= $log_level) {
cf9993c5c7df Updated .vimrc for some helper commands.
luka
parents: 1
diff changeset
40 print($str . "\n");
cf9993c5c7df Updated .vimrc for some helper commands.
luka
parents: 1
diff changeset
41 }
1
ca36acd2bef2 Have a base going, there is definitly a lot wrong with some of the files and the general structure but overall, it's a starting point
luka
parents:
diff changeset
42
2
cf9993c5c7df Updated .vimrc for some helper commands.
luka
parents: 1
diff changeset
43 }
1
ca36acd2bef2 Have a base going, there is definitly a lot wrong with some of the files and the general structure but overall, it's a starting point
luka
parents:
diff changeset
44 }