-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change private properties to protected #12
Comments
@rotexdegba I can add |
Below are the methods I would need you to add to \Ginfo\OS\Windows. protected function setPowershellDirectory(string $path): self
{
$this->powershellDirectory = $path;
return $this;
}
protected function addToInfoCache(string $name, $value): self
{
$this->infoCache[$name] = $value;
return $this;
}
protected function infoCacheContains(string $name): bool
{
return \array_key_exists($name, $this->infoCache);
}
protected function getFromInfoCache(string $name, $defaultValue=null)
{
return $this->infoCacheContains($name) ? $this->infoCache[$name]: $defaultValue;
}
protected function removeFromInfoCache(string $name):self
{
if ($this->infoCacheContains($name)) {
unset($this->infoCache[$name]);
}
return $this;
}
protected function cleanInfoCache(): self
{
$this->infoCache = [];
return $this;
} Do you think they should be public or protected? Thanks |
@rotexdegba idk, at this moment i think it's not important. we can start with protected visibility |
@Gemorroj OK that sounds good. |
@Gemorroj do you want me to send you a pull request or are you going to do it yourself? |
@rotexdegba can you try the master branch? |
@Gemorroj Thanks, I have pulled the latest changes from master and it works as expected. Do you know when you will be tagging another release with all your most recent changes (I am uncomfortable specifying dev-master in my composer.json and would like to switch from "gemorroj/ginfo": "dev-master" back to "gemorroj/ginfo": "^5.1" in my composer.json)? |
@rotexdegba i'd released 5.2.0 version |
Thanks a million for your quick response. Everything works fine now. Cheers |
Hi There,
I am using this package in a web-application I am developing which is supposed to return system information in json format to various clients. This package does not work in windows when I run my application via the php builtin web-server. It however works when I run a script using this package on the command-line. My Powershell execution policy is good:
When I ran my application via the php builtin web-server (via php -S 0.0.0.0:8880 -t .), I added the code below to Line 45 of \Ginfo\OS\Windows:
and it generated the output below:
When I run a script (test.php, which is in the same folder as my web-application) below via php test.php on the command-line, it works correctly:
My Operating System is Windows 10 Home Version 2004 (OS Build 19041.508). My PHP info:
To get my web-application to work properly with this package on Windows 10, I had to write a new sub-class of \Ginfo\OS\Windows. The code for this sub-class follows below:
This sub-class works for me and it uses the native php function shell_exec instead of SymfonyProcess used in \Ginfo\OS\Windows. I guess the issue is with SymfonyProcess. You made the $infoCache and $powershellDirectory properties of \Ginfo\OS\Windows private, and as a result, I can't use them in my sub-class.
Could you please change them from private to protected or do you want me to create a pull request with these changes?
ginfo/src/OS/Windows.php
Line 26 in a5da3e6
ginfo/src/OS/Windows.php
Line 27 in a5da3e6
Thanks for your anticipated cooperation,
Rotimi
NOTE: The package works fine in my CentOS 7 Linux environment, by the way.
The text was updated successfully, but these errors were encountered: