Fork me on GitHub
Subscribe 3

Ticket #418 (open enhancement)

Change the utf8 module to use OOP

  • Created: 2011-04-22 09:04:09
  • Reported by: Reines
  • Assigned to: FSX
  • Milestone: 2.0-alpha1
  • Component: code
  • Priority: normal

Making use of OOP in the utf8 module, then having UTF8::strlen rather than utf8_strlen would be much tidier. It would also be nice if we could load the additional utf8 functions using for example UTF8::load_function('ucwords') and then UTF8::ucwords(), rather than needing to include the file manually.

History

Franz 2011-08-06 21:15:03

  • Owner set to FSX.

Reines 2012-01-26 16:39:47

Should this ticket actually be changed to use namespaces rather than OOP now?

Franz 2012-01-26 16:44:00

Probably. Frank already did something with namespaces in his repo.

FSX 2012-01-26 17:19:45

It's done: https://github.com/FSX/php-utf8/commit/ … 046a9ea18c

I also renamed a few functions.

Note: Not all functions are the same in my repo. Like the fucntion Reines fixed a while ago.

Reines 2012-01-26 17:29:30

Ah awesome. I guess this ticket can turn into integrate the changes into fluxbb then, and I guess also merge any changes needed back.

On a sidenote, I don't like the idea of renaming utf8_strlen to len, and so on for all the functions. I think it's much cleaner to copy the original PHP function name and use strlen.

FSX 2012-01-26 18:16:22

Ok, I thought using the Zend coding guidelines was better than using PHP's function names. And since where dealing with utf8 the input data is always a string. So that's why I removed the 'str' parts.

Reines 2012-01-26 18:45:04

Yeah I'm not saying it's a wrong decision - just personally I don't agree with it smile

Franz 2012-01-26 22:39:46

I think we should use the original names, especially since namespaces make that easy (almost magic).

Will we change the namespace to FluxBB or simply make sure Frank's project fits the schema and ignore our repo?

Reines 2012-01-27 10:15:31

Use our repo - that way if we need to modify any functions for bug fixes or performance we aren't reliant on Frank fixing it.

Franz 2012-05-08 20:18:45

Again, we could also use Patchwork/Utf8 here. That way, we wouldn't have to take care of maintaining this library (but would depend on someone else, obviously).

FSX 2012-05-11 17:54:38

A week ago, I got an email again from the developer of Patchwork/Utf8 about using it in FluxBB. And my answer was:

Pong,

Sorry, I haven't responded yet. I'm not doing much PHP development
anymore so I think it's a good idea to switch to Patchwork-UTF8,
because there's you working on it. php-utf8 needs more attention that
I can give it at the moment. I haven't looked at your library besides
peeking at some code.

When Patchwork-UTF8 is going to patched into FluxBB, I could make some
time to do that.

Regards,
Frank Smit

---

He hasn't responded to my email yet.