-
Notifications
You must be signed in to change notification settings - Fork 32
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
Getting list of all CodeDefinitions #58
Comments
It wouldn't be bad, but I suggest a little change to your patch: -public function getCodeDefinitions() {
+public function getCodeDefinitions() : CodeDefinitionSet {
return $this->bbcodes;
} And then let |
@Kubo2 Really? This sounds a bit like "let's use SPL for the sake of having used SPL" When I was working on the parser, I've been tempted to let it implement an iterator interface, which would make sense to some degree. But in the end I found this to bring little advantage while introducing bc-breaking api changes. It may still be worth to let nodes and nodevisitors implement \SplSubject and \SplObserver once a major release is in sight. |
Well, then maybe it would be a good solution to create getter methods on
the CodeDefinition class. For now, you could probably just extend the
CodeDefinition class and __construct it with a CodeDefinition object as an
argument:
<?php
class CodeDefinition {
protected $a, $b;
}
class CodeDefinitionInfo
extends CodeDefinition {
private $o;
function __construct(CodeDefinition $o)
$this->o = $o;
}
function getA() {
return $this->a;
}
function getB() {
return $this->b;
}
}
You get the idea, hope it helps for now.
Kubis
On 15-Mar-2017 9:34 am, "pedjas" <[email protected]> wrote:
I am still on this issue.
I've created custom class that inherits Parser, and added this method to
get list of BBC. Well I got the array if CodeDefinition but all properties
are protected so I cannot access information about BBC.
I need this so I can display list of supported codes to the user and allow
him to insert bbcode by clicking its name. I need at least BBC name to be
visible.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#58 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AGkFJ0N50AsgC_2V2zjKxe3d8uj0-y1Rks5rl6KEgaJpZM4E2x4h>
.
|
Actually, there is getter for Tag name: getTagName(); |
I needed list of all code definitions Parser can handle, but could not find a way to get it.
I suggest expanding class Parser with something like this:
The text was updated successfully, but these errors were encountered: